home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / docprep.zip / DOCPREP.MAN < prev    next >
Text File  |  1992-05-14  |  129KB  |  2,719 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.                      OCCASIONAL PUBLICATIONS IN ACADEMIC COMPUTING
  14.  
  15.                                         Number 7
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.                    DOCUMENT PREPARATION AIDS FOR NON-MAJOR LANGUAGES
  31.  
  32.  
  33.                                            by
  34.  
  35.  
  36.                                 Andy Black, David Weber,
  37.                                Fred Kuhl, and Kathy Kuhl
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.                          Summer Institute of Linguistics, Inc.
  54.                                        Dallas, TX
  55.  
  56.                                           1987
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.           Occasional  Publications  in  Academic  Computing  is   devoted   to
  68.           publishing  computer  software  and  documentation  deemed  to be of
  69.           potential  usefulness  to  members  of  the  Summer   Institute   of
  70.           Linguistics  for  carrying  out their field projects in linguistics,
  71.           literacy, anthropology, and translation.  The software published  in
  72.           the  series  may  represent  work  in  progress.  In publishing this
  73.           software, the Summer Institute of Linguistics,  Inc.  is  making  no
  74.           commitment   to   maintenance,  but  is  committed  to  making  full
  75.           disclosure of source code in cases where maintenance requests cannot
  76.           be serviced.
  77.  
  78.           EDITOR: Gary F. Simons
  79.           ASSISTANT EDITOR: Linda L. Simons
  80.  
  81.           This  manual  documents  the WRDCHG, SYLCHK, SYLCOR, SPLCOR, HYPHEN,
  82.           and DELIM programs.  These programs are written in the C programming
  83.           language  for  on-the-field  application using personal computers or
  84.           small time-sharing  systems.   They  run  under  the  RT-11,  MS-DOS
  85.           (including Sharp PC5000), TSX, and UNIX operating systems.
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.               Copyright (c) 1987, by Summer Institute of Linguistics, Inc.
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.           Editorial correspondence or program bugs should be addressed to:
  102.           
  103.                Academic Computing
  104.                Summer Institute of Linguistics
  105.                7500 West Camp Wisdom Road
  106.                Dallas, TX  75236
  107.           
  108.           
  109.           Requests for further copies, standing orders, or accompanying
  110.                software diskettes should be addressed to:
  111.           
  112.                Bookstore
  113.                Summer Institute of Linguistics
  114.                7500 West Camp Wisdom Road
  115.                Dallas, TX  75236
  116.  
  117.  
  118.  
  119.  
  120.  
  121.                                         CONTENTS
  122.  
  123.  
  124.           1. INTRODUCTION                                                4
  125.           1.1 Overview of program functions                              4
  126.           1.2 Overview of program structure                              5
  127.           1.3 Some lessons from history                                  6
  128.              
  129.           2. WORD CHANGE (WRDCHG)                                        8
  130.           2.1 Introduction                                               8
  131.           2.2 Making a change table                                      8
  132.           2.3 The default mode                                          11
  133.           2.4 Making a standard format marker field file                11
  134.           2.5 Running the program                                       12
  135.           
  136.           
  137.           3. SYLLABLE-BASED SPELLING CHECKING (SYLCHK)                  14
  138.           3.1 Introduction                                              14
  139.           3.2 Running the program                                       14
  140.           3.3 The form of the output                                    16
  141.           3.4 How to write the ONC file                                 16
  142.           3.5 How to write an orthography change table                  17
  143.           
  144.           4. SYLLABLE-BASED SPELLING CORRECTION (SYLCOR)                18
  145.           4.1 Introduction                                              18
  146.           4.2 Initiating a session with SYLCOR                          19
  147.           4.3 Screen layout                                             23
  148.           4.4 Handling possible errors: word edit mode                  24
  149.           4.5 Making the auto-correction and exceptions files           25
  150.           4.6 Ending a session with SYLCOR                              26
  151.           4.7 Writing your own auto-correction and exception files      26
  152.                                                                   
  153.           5. SPELLING CORRECTION WITH TABLE LOOKUP (SPLCOR)             27
  154.           
  155.           6. HYPHENATION (HYPHEN)                                       27
  156.           6.1 Introduction                                              27
  157.           6.2 Data files                                                28
  158.           6.3 Running the program                                       32
  159.           6.4 Examples                                                  34
  160.           6.5 Miscellaneous                                             40
  161.           
  162.           7. DELIMITER CHECKING AND NESTING CHECK (DELIM)               42
  163.           7.1 Introduction                                              42
  164.           7.2 Running the program                                       42
  165.           7.3 The form of the output                                    43
  166.           7.4 How to write a delimiter file                             44
  167.           7.5 Program limitations                                       44
  168.  
  169.  
  170.  
  171.           DOCUMENT PREPARATION AIDS                                          4
  172.  
  173.                                     1. INTRODUCTION
  174.  
  175.                The programs described in this booklet are  aids  to  producing
  176.           documents.   They  are  useful  for a wide range of languages.  Each
  177.           arose in response to a need felt  by  field  linguists  involved  in
  178.           producing documents in non-English languages.
  179.  
  180.           1.1 Overview of program functions
  181.  
  182.                WRDCHG  makes  changes to the words of a text, while preserving
  183.           capitalization,  punctuation  and  formatting.   It  is  useful  for
  184.           correcting  spelling  and  typographic  errors, or even for adapting
  185.           text between closely related dialects.  It  is  simple  to  use,  it
  186.           allows  for  conditioning  in  terms  of  word boundaries, and it is
  187.           efficient when hundreds of changes are involved  because  it  stores
  188.           the changes in a dense form and because it is fast.
  189.  
  190.                SYLCHK  identifies  potential  spelling  errors  in text, using
  191.           decomposition into syllables as the method for identifying  possible
  192.           errors,  and returns these as a list.  The user supplies information
  193.           about the syllable structure of the language.
  194.  
  195.                SYLCHK and  WRDCHG  work  together  to  correct  many  spelling
  196.           errors.   SYLCHK  is  first  run  on  the  text to collect potential
  197.           errors.  This list is then (optionally) sorted  and  duplicates  are
  198.           eliminated,  and then it is edited to make a list of changes.  These
  199.           changes are then made to the text with WRDCHG.
  200.  
  201.                However, this method has a weakness: without context, the  user
  202.           may  not know how to correct some errors.  For example, if the error
  203.           were ther, one would not know whether it should be corrected to the,
  204.           their, there, other, or something else.  This sort of case motivated
  205.           the next program.
  206.  
  207.                SYLCOR  is  an  interactive  editor  for  correcting  potential
  208.           errors.    SYLCOR   identifies  potential  errors  by  the  syllable
  209.           decomposition algorithm used in SYLCHK, using the same data files as
  210.           SYLCHK.   When  a  potential  error is found, it is displayed in the
  211.           upper portion of the screen with the surrounding text and in a  work
  212.           area  in the lower portion of the screen, where it can be corrected.
  213.           If the word is modified, the user may make the change  an  automatic
  214.           correction.   If  it  is not modified, the user may add it to one of
  215.           various  lists  of  exceptions  (for  example,  names,  loan  words,
  216.           acronyms, and so on).
  217.  
  218.                SPLCOR  is  like SYLCOR except that, rather than using syllable
  219.           decomposition for detecting errors, it assumes that  a  word  is  an
  220.           error  unless  it is found on one of the exceptions lists.  This may
  221.           be a useful approach for languages where the writing system  or  the
  222.           phonology  (or  both!) make syllable decomposition ineffectual as an
  223.           error detection algorithm.  The user simply accumulates  a  list  of
  224.           all words which are to be passed without further attention.
  225.  
  226.                This  brings  up  an  interesting question: What are some other
  227.           useful error detection methods?  Syllable decomposition  has  proven
  228.           to  be  useful  in  many languages, particularly where syllables are
  229.           fairly restricted and the writing system  represents  the  phonology
  230.           closely.  But it will not yield the same results for every language;
  231.  
  232.  
  233.  
  234.           Introduction                                                       5
  235.  
  236.           for example, it is  less  effective  for  Spanish  than  it  is  for
  237.           Quechua.
  238.  
  239.                Another    possibility    is    morphological   parsing,   i.e.
  240.           decomposition  into  morphemes  rather  than  into  syllables.   For
  241.           Quechua,  morphological  parsing  is  a  more  effective method than
  242.           syllable decomposition, but it is also more costly in terms  of  the
  243.           complexity  of  the  program, the data which must be provided by the
  244.           user, and the data which must be loaded each  time  the  program  is
  245.           run.
  246.  
  247.                There  are  other  schemes that have been used other languages.
  248.           One algorithm for English passes a three-character window  over  the
  249.           word,  looking  up  the  probability  for  the  occurrence  of  each
  250.           character triple in a table. (These probabilities are established by
  251.           running  the program in a training mode on large portions of correct
  252.           text.)  The word  is  rejected  or  passed  as  a  function  of  the
  253.           probabilities of its character triples.
  254.  
  255.                I  leave  the  following  question  with  the  reader:  for the
  256.           language to which you wish to apply spelling error  detection,  what
  257.           would  be the best method of detecting possible errors?  If you come
  258.           up with a new idea, perhaps  we  can  prepare  alternative  programs
  259.           which  are  like  SYLCOR  and SPLCOR, but which have different error
  260.           detection algorithms.  SPLCOR provides the skeleton into which other
  261.           algorithms  for  error detection -- ones that you devise -- could be
  262.           inserted; the program source code is available for those who wish to
  263.           give it a try.
  264.  
  265.                HYPHEN  introduces  a  user-determined  character  at  syllable
  266.           boundaries.  This can  be  used  as  a  "discretionary  hyphen"  for
  267.           formatting with a program like Manuscripter.  The user provides data
  268.           in terms of which the program recognizes syllable  boundaries.   The
  269.           user  can control how close to the word boundaries the discretionary
  270.           hyphen may occur, so as to avoid stranding parts of words which  are
  271.           too small.
  272.  
  273.                DELIM checks text to see that delimiters (characters like quote
  274.           marks, brackets, braces, parentheses, and  so  on)  are  paired  and
  275.           properly  nested.   This  is  useful  for  technical  papers and for
  276.           computer  programs,  both  of  which  often  contain  a  great  many
  277.           delimiters.   The  user  has  control  over what DELIM regards as an
  278.           opening delimiter character and what is  the  corresponding  closing
  279.           delimiter.   DELIM  reports  errors  by  giving the line number, the
  280.           line, and indicating the offending delimiter.
  281.  
  282.           1.2 Overview of program structure
  283.  
  284.                WRDCHG, SYLCOR,  SPLCOR,  and  HYPHEN   share  the  same  basic
  285.           program  structure,  as proposed in Weber and Kasper "Getting at the
  286.           Words in Text," Notes on Linguistics  2:17-22  (1983).   The  module
  287.           which  performs  the particular action on a word is lodged between a
  288.           module TXTIN which separate the word from other  characteristics  of
  289.           the  text (capitalization, punctuation, formatting), a module TXTOUT
  290.           which recomposes the text with the possibly-modified word  in  place
  291.           of the original word.  See the following diagram:
  292.  
  293.  
  294.  
  295.           DOCUMENT PREPARATION AIDS                                          6
  296.  
  297.           
  298.                                    +--------+
  299.                      words ------- | ACTION | ---- (modified) words
  300.                        |           +--------+             |
  301.                        |                                  |
  302.                   +---------+   punct,capit,format   +---------+
  303.                   |  TXTIN  | ---------------------- | TXTOUT  |
  304.                   +---------+                        +---------+
  305.                        |                                  |
  306.                    input text                        output text
  307.           
  308.  
  309.           (SYLCHK uses the TXTIN module, but since  it  does  not  produce  an
  310.           output  text, it does not use TXTOUT.)  Because these programs share
  311.           this  structure,  they  share  a  lot  of  code,  facilitating  both
  312.           development  and maintenance.  I suspect that other, future programs
  313.           could benefit from this architecture, and perhaps even the TXTIN and
  314.           TXTOUT modules.
  315.  
  316.           1.3 Some lessons from history
  317.  
  318.                A  bit  of  history  is  in  order,  particularly  since  it is
  319.           instructive as to how programs such as these can arise  in  response
  320.           to needs felt by field linguists.
  321.  
  322.                My  involvement in the development of these programs (exclusive
  323.           of HYPHEN) has been to see  the  need  for  a  program,  to  get  an
  324.           approximate  conceptualization  of  the  program,  to write out some
  325.           elementary design, to  interact  with  the  implementors  (answering
  326.           questions about how I think it should work, providing test data, and
  327.           so on), and helping to write documentation.
  328.  
  329.                The programing  expertise  was  virtually  all  contributed  by
  330.           volunteers.   The  first volunteer was Bob Kasper.  Bob came to Peru
  331.           upon finishing his B.S.  at  Cornell  University  to  implement  the
  332.           Computer  Assisted  Dialect  Adaptation program.  As part of this he
  333.           wrote the TXTIN and TXTOUT functions.  The CADA program  required  a
  334.           change  module,  so  after  that was developed, I suggested that Bob
  335.           make the WRDCHG program by putting that  module  between  TXTIN  and
  336.           TXTOUT.   Since  all  the pieces were there, it was not a major job,
  337.           and the first version of WRDCHG was born.  About the  same  time,  I
  338.           began  learning  the  C  programming  language,  and wrote the first
  339.           version of SYLCHK and DELIM with Bob's help.
  340.  
  341.                During Bob's stay in Peru, Alex Waibel (who  worked  in  speech
  342.           research  at Carnegie-Mellon University) came to Peru for a two week
  343.           "working" vacation.  Bob and I had a design document ready for Alex,
  344.           and  about  a  week  and  a  half after arriving, Alex had a working
  345.           editor, called CADAED, for application to CADA output text.
  346.  
  347.                About two years later, Fred and Kathy Kuhl came to Peru  for  a
  348.           six  week  period.  Fred had just finished his doctorate in Computer
  349.           Science and Kathy had taken several courses in programming.   I  had
  350.           written  a  design  of SYLCOR based on my experience with a spelling
  351.           corrector on another system, and  on  Bob's  TXTIN  and  TXTOUT,  my
  352.           SYLCHK,  and  Alex's  CADAED.  I also had some ideas for how WRDCHG,
  353.           SYLCHK and DELIM could be improved.  Fred and Kathy  went  right  to
  354.           work,  Fred  on  WRDCHG  and  SYLCOR, and Kathy on SYLCHK and DELIM.
  355.  
  356.  
  357.  
  358.           Introduction                                                       7
  359.  
  360.           When Fred and Kathy left six weeks later, the programs were as  they
  361.           now are.
  362.  
  363.                SYLCOR  incorporates  work  which  Bob,  Alex, Kathy and I did,
  364.           combined masterfully by Fred.  Thus, for me, SYLCOR is a monument to
  365.           cooperation,  volunteerism,  and professionalism.  Bob, Alex, Kathy,
  366.           and Fred contributed their skills, writing code which  others  could
  367.           build  upon  or  building  on  the  work of the former.  My role was
  368.           simply to orchestrate this development.
  369.  
  370.                My experience with these programs  has  confirmed  something  I
  371.           first  learned by working with Bill Mann: that "linguistic" software
  372.           is probably best developed as a collaboration between  the  linguist
  373.           and  the  computer  professionals.   The  linguist must identify the
  374.           problem(s) for which software is  needed,  conceptualize  a  program
  375.           (which must be computationally tractable), and then communicate this
  376.           to the computer professional, whose responsibility is to refine  the
  377.           linguist's  conceptualization  and  produce the code.  And, computer
  378.           professionals who are willing to go  to  the  field  (to  where  the
  379.           linguist  confronts  the situation for which he feels the need for a
  380.           program) can make a large contribution, even if  they  only  stay  a
  381.           short while.
  382.  
  383.                The  development of the HYPHEN program suggests another lesson.
  384.           HYPHEN was written by Andy Black in response to an obvious  need  to
  385.           introduce  discretionary  hyphens for the text formatting demands in
  386.           the SIL computer center he manages.  Andy could  have  started  from
  387.           scratch  and  written  the  program  entirely  himself.   But, being
  388.           familiar with the architecture and code used  for  WRDCHG,  he  used
  389.           TXTIN  and TXOUT.  This accelerated his development effort, and will
  390.           save program maintenence time in the future.
  391.  
  392.                Andy's example makes me optimistic  about  the  development  of
  393.           other programs -- as yet unanticipated -- which can be built without
  394.           exorbitant effort from program parts which are already in hand.   If
  395.           we  can  make our software development cooperative in this way, each
  396.           building as much as possible on  the  work  of  others  rather  than
  397.           starting  from  scratch  for  every  program,  and  if, as discussed
  398.           earlier, we  can  bring  together  the  linguist  and  the  computer
  399.           professional, then perhaps we might be able to fulfill -- to a large
  400.           measure -- our need for linguistic software.
  401.  
  402.                There are other people whose names do not appear as authors but
  403.           who   have   contributed   considerable   effort  in  bringing  this
  404.           publication to reality.  Steve McConnel ported the programs  to  the
  405.           other   operating  systems  and  in  doing  so  cleaned  up  several
  406.           inconsistencies  within  and  between  the  programs.   Gary  Simons
  407.           provided  general  editorial  advice and offered suggestions to make
  408.           the programs more general so they could be used in language families
  409.           quite  different  from the one they were originally designed to work
  410.           for.  Linda Simons tested the ported verions along  with  Steve  and
  411.           took  the  documentation  through several updates to keep it in line
  412.           with the program improvements.
  413.  
  414.  
  415.  
  416.           DOCUMENT PREPARATION AIDS                                          8
  417.  
  418.                                 2. WORD CHANGE (WRDCHG)
  419.  
  420.           2.1 Introduction
  421.  
  422.                Word Change (WRDCHG) passes over  a  text,  changing  words  as
  423.           specified  by  the  user  in a change table.  WRDCHG can only change
  424.           words;   it   cannot   change   punctuation,   format   marking   or
  425.           capitalization.   (Each  output word will have the capitalization of
  426.           the corresponding input word.)  It is possible to condition  changes
  427.           as  applying  only  at word boundaries.  The speed of application is
  428.           not substantially affected by the number of changes  in  the  change
  429.           table; a large number (perhaps as many as 1500) can be made quickly.
  430.           It also can apply the changes  only  to  specified  standard  format
  431.           fields.   This  gives  the  ability  to  make  changes  to  only the
  432.           vernacular entries of a dictionary, for example.
  433.  
  434.           2.2 Making a change table
  435.  
  436.                A change table is a list of paired strings, each string bounded
  437.           by  double  quotes  (").   The  first string of a pair is called the
  438.           "match string"; it specifies some pattern to be matched in  a  text.
  439.           The  second string, called the "substitution string," specifies what
  440.           is to be substituted for each  occurrence  of  the  matched  string.
  441.           Observe the following in writing a change table:
  442.  
  443.                1. The  changes  in  a  table may occur in any order (i.e., the
  444.                   order in which changes occur in a table makes no  difference
  445.                   in  the  effect upon any text).  Therefore changes cannot be
  446.                   "ordered."  That  is,  a  second  change  dependent  upon  a
  447.                   condition  created  by  a  first  change will not work.  For
  448.                   example, if the following two changes are in a  table,  only
  449.                   the  first  will  occur  since the program will not scan the
  450.                   input text a second time to find "bi?u".
  451.  
  452.                          "'"      "?"
  453.                          "bi?u"   "bi?o"
  454.  
  455.                2. All changes should be  given  in  lower  case.   It  is  not
  456.                   necessary  to give a change with various capitalizations, as
  457.                   the result of any change will be  capitalized  just  as  the
  458.                   original word.  For example, the change
  459.  
  460.                           "yeild" "yield"
  461.  
  462.                   will  change  "yeild"  to  "yield",  "Yeild"  to "Yield" and
  463.                   "YEILD"  to  "YIELD".    (WRDCHG   recognizes   only   three
  464.                   possibilities,   all  lower  case,  all  upper  case,  first
  465.                   character capitalized.)
  466.  
  467.                3. If a character (other than space or tab) appears on  a  line
  468.                   before  the  first  double  quote  mark,  then  that line is
  469.                   regarded as a comment, and any change on that  line  is  not
  470.                   applied.   This  provides a simple mechanism for disabling a
  471.                   change: simply put some character ahead of the first string.
  472.                   For example, the following line would not make any change:
  473.  
  474.                           off "this" "that"
  475.  
  476.  
  477.  
  478.  
  479.           Word Change                                                        9
  480.  
  481.                4. Any character(s) may be placed between the  left  and  right
  482.                   strings.    This   allows  whatever  notation  you  like  to
  483.                   symbolize the change; The  following  lines  have  the  same
  484.                   effect:
  485.  
  486.                           "mispelled" becomes "misspelled"
  487.                           "mispelled" --> "misspelled"
  488.                           "mispelled" > "misspelled"
  489.                           "mispelled" "misspelled"
  490.  
  491.                5. Anything  following the right string is ignored, so comments
  492.                   may follow the pair of strings; for example,  the  following
  493.                   three changes are effective:
  494.  
  495.                           "kachaka"       "alliya"        `get well'
  496.                           "qo"            "qara"          `give'
  497.                           "fiyupa"        "aliska"        `very much'
  498.  
  499.                6. Changes  may  be  specified  as  applying  (a) only  at  the
  500.                   beginning of a word, (b) only at  the  end  of  a  word,  or
  501.                   (c) only if the complete word is matched.  To specify that a
  502.                   change applies only at the beginning of a  word,  include  a
  503.                   space  between  the  leading  double  quote  and  the  first
  504.                   character of the match string; for  example,  the  following
  505.                   change affects only the first "ka" in "kaykan":
  506.  
  507.                           " ka" "ke"
  508.  
  509.                   To  specify that a change applies only at the end of a word,
  510.                   include a space between the final  character  of  the  match
  511.                   string  and  the  following  double  quote; for example, the
  512.                   following   change   affects   only   the   last   "na"   of
  513.                   "nakananpaqna":
  514.  
  515.                           "na " "nya"
  516.  
  517.                   To specify that a change applies only when the complete word
  518.                   is matched, include spaces both at the beginning and end  of
  519.                   the  match  string;  for  example, the following changes the
  520.                   word "na" when it stands  alone,  but  would  not  make  any
  521.                   change to "nakananpaqna":
  522.  
  523.                           " na " "nya"
  524.  
  525.                7. A  change table may have multiple changes whose match string
  526.                   has the same character string but which differ in  terms  of
  527.                   boundary  conditions.  The order of priority for application
  528.                   of changes whose match  strings  are  the  same  except  for
  529.                   boundary conditions is 3 > 2 > 1 > 0 where
  530.  
  531.                      (0) anywhere within a word
  532.                      (1) only at the end of a word
  533.                      (2) only at the beginning of a word
  534.                      (3) only when the entire word is matched
  535.  
  536.                   That  is,  3  applies  in  preference  to  0-2, 2 applies in
  537.                   preference to 1 and 0, and 1 applies in preference to 0.  (A
  538.                   way  to  think  of  this  is  that  the change with the most
  539.  
  540.  
  541.  
  542.           DOCUMENT PREPARATION AIDS                                         10
  543.  
  544.                   restricted conditions is applied in preference to  a  change
  545.                   with  a  less  restricted condition.)  For example, consider
  546.                   Change Table I:
  547.  
  548.                           TABLE I
  549.                   
  550.                           "na"    "naa"   (0) anywhere
  551.                           "na "   "nac"   (1) only at the end
  552.                           " na"   "nab"   (2) only at the beginning
  553.                           " na "  "nad"   (3) if complete word
  554.  
  555.                   Change    Table    I    changes     "Nakamaananpaqna"     to
  556.                   "Nabkamaanaapaqnac".   The first instance of "na" is changed
  557.                   to  "nab"  because  the  change  with   the   "word-initial"
  558.                   condition  (2)  applies in preference to the change with the
  559.                   "anywhere" condition (0).  Likewise, the  last  instance  of
  560.                   "na"  becomes  "nac"  by  the  change  with the "word-final"
  561.                   condition (1) because it applies in preference to the change
  562.                   with the  the "anywhere" condition (0).  The second instance
  563.                   of "na" is changed by the "anywhere" change because that  is
  564.                   the  only  change  whose conditions are met.  Change Table I
  565.                   changes the isolated word "na" to "nac".  In this case,  all
  566.                   of  the  changes  are, in principle, applicable, but the one
  567.                   with the "complete word" condition applies in preference  to
  568.                   the others (0-2).
  569.  
  570.                   Further, consider Change Table II:
  571.  
  572.                           TABLE II
  573.                           "na "   "nac"   (1) only at the end
  574.                           " na"   "nab"   (2) only at the beginning
  575.  
  576.                   In  this case the change which applies only at the beginning
  577.                   of a word (2) applies in  preference  to  the  change  which
  578.                   applies at the end of the word (1).
  579.  
  580.                   If  the  same  match  string (including boundary conditions)
  581.                   occurs in more than one change in a table,  the  last  given
  582.                   will  prevail.   Thus,  if  a  table contained the following
  583.                   lines, "number" would be changed to "last".
  584.  
  585.                           "number" "first"
  586.                           "number" "last"
  587.  
  588.                8.  In an instance where one change table makes a substitutiton
  589.                   string  for  "a"  and also for "ab", the "ab" change will be
  590.                   made but  the  "a"  change  will  not  also  be  made.   For
  591.                   instance, in the table
  592.  
  593.                           "'"     "?"
  594.                           "'u"    "'o"
  595.                   all  occurrences of "'u" willbe changed to "'o" but will not
  596.                   be changed to "?u".  All other occurrences of "'" will go to
  597.                   "?".   To  solve this problem, the second line of the change
  598.                   table should read: "'u" "?o".
  599.  
  600.  
  601.  
  602.           Word Change                                                       11
  603.  
  604.           2.3 The default mode
  605.  
  606.                In many cases, virtually all the changes in a table  will  have
  607.           the  same condition.  For example, suppose that you are working in a
  608.           language which does not have prefixes, and you wish to make a number
  609.           of  changes  to  roots.   It  would  be  possible to insure that the
  610.           changes apply only to roots by including a space at the beginning of
  611.           each  match  string.   However,   this  has been made unnecessary by
  612.           providing the appropriate "default mode" at the time of running  the
  613.           program.  WRDCHG gives the following prompt:
  614.  
  615.                   Should changes be made
  616.                      (0) anywhere within a word
  617.                      (1) only at the end of a word
  618.                      (2) only at the beginning of a word
  619.                      (3) only when the entire word is matched
  620.                   Type 0, 1, 2, or 3 :
  621.  
  622.           The effect of answering 0 (or RETURN) is that all changes will occur
  623.           exactly as you have specified them in the  change  table,  including
  624.           the  leading  and/or following spaces you have included.  The effect
  625.           of answering "1" is as though a space were included at the beginning
  626.           of  each  match  string;  the effect of answering "2" is as though a
  627.           space were included at the end of each match string, and the  effect
  628.           of  adding  "3"  is as though spaces were added at the beginning and
  629.           end of the match string.  Note that it the appropriate response  can
  630.           make it unnecessary (though not incorrect) to include a space in the
  631.           actual change table.  For example, Change  Table  III  applied  with
  632.           default mode "3" is equivalent to applying Change Table IV:
  633.  
  634.                    TABLE III        TABLE IV
  635.           
  636.                   "yee" "yey"     " yee " "yey"
  637.                   "kyo" "kiw      " kyo " "kiw
  638.                   "pok" "puk"     " pok " "puk"
  639.  
  640.           2.4  Making a standard format marker field file
  641.  
  642.                This  file gives you the ability to pick and choose which parts
  643.           of a standard format file the changes are to apply to.  To do  this,
  644.           merely  create  a  file  listing  the markers indicating the desired
  645.           fields.  If you want all fields or if  the  file  does  not  contain
  646.           standard format data, then this file should be empty.  The layout of
  647.           this file is very free.  Thus the following are all equivalent:
  648.  
  649.                (1)   The following markers indicate which fields
  650.                         are to be change:
  651.                      \w
  652.                      \i
  653.           
  654.                (2)   \w
  655.                      \i
  656.           
  657.                (3)   \w\i
  658.  
  659.  
  660.  
  661.  
  662.           DOCUMENT PREPARATION AIDS                                         12
  663.  
  664.           2.5 Running the program
  665.  
  666.                When WRDCHG starts it prints the following:
  667.  
  668.                   WORD CHANGE  Version 2.3 (12-Dec-86)
  669.  
  670.           You are first informed of how much memory is available for a  change
  671.           table by a message like the following:
  672.  
  673.                   SETUP-ALLOC 22832 bytes for records
  674.  
  675.           You  are  then  asked  to indicate characters which you wish to have
  676.           treated as alphabetic characters along with the standard ones.  Note
  677.           that  all  other characters will be regarded as occurring outside of
  678.           words.  For example, if one wished to change "didn't" to "did  not",
  679.           the  apostrophe  (')  would  have  to  be  treated  as an alphabetic
  680.           character; otherwise WRDCHG will treat "didn't" as two words, "didn"
  681.           and "t".
  682.  
  683.                   Type RETURN to include these as alphabetic characters: ~'
  684.                   Otherwise type the characters desired:
  685.  
  686.           After  you respond, WRDCHG will inform you of the characters it will
  687.           treat as alphabetic.  For example, if  you  responded  by  typing  a
  688.           tilde (~), you will then see the following:
  689.  
  690.                   Using the following as alphabetics:
  691.                   ~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
  692.  
  693.                Before  you  are asked for the name of the change table, WRDCHG
  694.           needs to know two things, the "trie level" and the  "default  mode."
  695.           We  will  now  discuss  each  of these in turn.  The change table is
  696.           stored in the computer's memory as a type of tree structure,  called
  697.           a  "trie."   Tries are more efficient than simple lists in two ways:
  698.           (a) it is possible to find entries much more quickly, and  (b)   for
  699.           large  tables, more changes can be stored.  The degree to which this
  700.           efficiency is attempted is set by the number you give in response to
  701.           the prompt:
  702.  
  703.                   Maximum number of levels in the trie:  [99]
  704.  
  705.           If  there  were  nothing to pay for the efficiency, one would simply
  706.           strive for the maximum, responding always with  a  carriage  return.
  707.           But  that is not the case.  If the dictionary is not great enough to
  708.           take advantage of the density you hope to  achieve,  more  space  is
  709.           used than necessary.  (It's something like packaging soap in economy
  710.           sized boxes: if you don't fill them the result takes  up  more  room
  711.           than necessary.)
  712.  
  713.                As  a  rule  of  thumb,  use  2 or 3 for tables with up to 1000
  714.           entries.  You will probably  develop  a  feel  for  what  number  is
  715.           appropriate;  you might even experiment, loading the same table with
  716.           different numbers and seeing which number leaves the most space  (as
  717.           reported  by  messages  concerning free space given before and after
  718.           the change table is loaded).  By the way, if you set the number  too
  719.           low (say 0 or 1 for over 500 entries) the time it takes to find each
  720.           change will increase considerably.
  721.  
  722.  
  723.  
  724.  
  725.           Word Change                                                       13
  726.  
  727.                Next you  will  be  asked  about  the  "default  mode"  by  the
  728.           following prompt:
  729.  
  730.                   Changes should be made:
  731.                      0) anywhere within a word
  732.                      1) only at the end of a word
  733.                      2) only at the beginning of a word
  734.                      3) only when the entire word is matched
  735.                   Type 0, 1, 2, or 3 : [0]
  736.  
  737.           This has been discussed above in section 2.3.
  738.  
  739.                Now  that  you  have provided the "trie level" and the "default
  740.           mode," WRDCHG is prepared to load a change table.  It  asks  for  it
  741.           with the following prompt: 
  742.  
  743.                   Change table file:
  744.  
  745.           When it is finished loading, it informs you of the number of changes
  746.           loaded and the amount of storage left.  For instance,
  747.  
  748.                   235 changes loaded.
  749.                   24733 bytes left, largest space is 14733 bytes.
  750.  
  751.           Now you are asked for the name of  the  file  that  indicates  which
  752.           specific  standard format fields the changes apply to.  This is done
  753.           by the following prompt:
  754.  
  755.                Standard format marker field file: (<RETURN> for all fields)
  756.  
  757.           See section 2.4 for a discussion of this  file.   If  you  want  all
  758.           fields,  then merely press the <RETURN> key.  You are next asked for
  759.           the name of the file to be changed:
  760.  
  761.                   Input file:
  762.  
  763.           You are also asked to give a name for the  output  file  (i.e.,  the
  764.           changed  file).   WRDCHG  makes up a default file name which you can
  765.           use by simply  responding with a carriage return.  For  example,  if
  766.           your  input  file  name is abcdef.sfm, then the prompt for an output
  767.           file will appear as:
  768.  
  769.                   Output file [abcdef.chg]:
  770.  
  771.           and by simply typing a carriage return you  can  create  the  output
  772.           file on the default device with the name abcdef.chg.  After the file
  773.           is processed, you will be informed at the terminal of the number  of
  774.           words  which  were  read  and  the  number which were altered with a
  775.           message like the following:
  776.  
  777.                   INPUT: 234 words
  778.           
  779.                   234 words read, 7 altered.
  780.  
  781.                WRDCHG allows multiple input files (all to  be  processed  with
  782.           the  same  change  file,  the  same trie level, and the same default
  783.           mode).  You are asked:
  784.  
  785.  
  786.  
  787.  
  788.           DOCUMENT PREPARATION AIDS                                         14
  789.  
  790.                   Next input file: (<RETURN> if no more)
  791.  
  792.           If you respond with a file name, you will be  asked  for  an  output
  793.           file  name  as  before,  and  that  file  will be processed.  If you
  794.           respond with a carriage return, you terminate WRDCHG and  return  to
  795.           the monitor.
  796.  
  797.  
  798.  
  799.                      3. SYLLABLE-BASED SPELLING CHECKING  (SYLCHK)
  800.  
  801.           3.1 Introduction
  802.  
  803.                SYLCHK    identifies    possible   typographical   errors   and
  804.           misspellings in texts by judging the phonological well-formedness of
  805.           each  word:  a  word  is a possible error if it cannot be decomposed
  806.           into one or more  well-formed  syllables.   SYLCHK  assumes  that  a
  807.           syllable  is made up of an optional onset, a vocalic nucleus, and an
  808.           optional coda; the user  must  supply  a  table  of  these  for  the
  809.           language  to  which he is applying SYLCHK.  (Obviously SYLCHK cannot
  810.           be applied in a language whose writing system does  not  approximate
  811.           phonological form.)
  812.  
  813.                SYLCHK  never alters the text to which it is applied.  However,
  814.           it may be used to correct text files in the following way:
  815.  
  816.                1. SYLCHK is applied to one or more  text  files,  accumulating
  817.                   the possible errors in a single output file.
  818.  
  819.                2. This  error  file  is  sorted  and edited to create a change
  820.                   table for correcting the errors.
  821.  
  822.                3. The change table is applied to the text files with a program
  823.                   like WRDCHG (in this package) or CC (Consistent Changes).
  824.  
  825.           3.2 Running the program
  826.  
  827.                When SYLCHK is run the following will appear on the screen:
  828.  
  829.                   SYLLABLE BASED SPELLING CHECK  Version 3.0 (15-Dec-86)
  830.  
  831.           You  are  then informed of how much memory is available by a message
  832.           like the following:
  833.  
  834.                   SETUP-ALLOC-10904 bytes for records
  835.  
  836.                You are then asked to indicate characters  which  you  wish  to
  837.           have  treated as alphabetic characters along with wht standard ones.
  838.           Note that all other characters will be regarded as occurring outside
  839.           of  words.   For  example,  if one wished to change "didn't" to "did
  840.           not", the apostrophe (') would have to be treated as  an  alphabetic
  841.           character; otherwise SYLCHK will treat "didn't" as two words, "didn"
  842.           and "t".
  843.  
  844.                Press <RETURN> to include these as alphabetic characters: ~'
  845.                Otherwise type the characters desired:
  846.  
  847.           After you respond, SYLCHK will inform you of the characters it  will
  848.  
  849.  
  850.  
  851.           Syllable-based Spelling Checking                                  15
  852.  
  853.           treat as alphabetic.  For example, if  you  responded  by  typing  a
  854.           tilde (~), you will then see the following:
  855.  
  856.                   Using the following as alphabetics:
  857.                   ~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
  858.  
  859.           The next thing SYLCHK does is ask for two things relating to the ONC
  860.           or Onset-Nucleus-Coda file.  Details about the form of this file are
  861.           given  below  in  section 3.4.  The ONC file tells the program which
  862.           characters (and character sequences) are  allowed  to  form  correct
  863.           syllables.   First  it  asks  for  the  character  you  have used to
  864.           separate ONC distribution classes in the ONC file, and then asks for
  865.           the name of this file:
  866.  
  867.                   Character which separates ONC distribution classes: [\]
  868.  
  869.                   ONC file:
  870.  
  871.           You  will  then be asked for an orthography change table.  If you do
  872.           not  want  to  use  a  change  table,  simply  press  <RETURN>.   An
  873.           orthography  change  table  allows  you to normalize the spelling of
  874.           words before they are  checked,  which  may  be  very  useful.   For
  875.           example,  in  the practical orthography for Quechua, long vowels are
  876.           represented as two vowels, (e.g.  long /a/ is represented as  "aa").
  877.           However,  in the phonological system, long vowels pattern as a vowel
  878.           followed by a consonant, so long /a/ patterns as an /a/ followed  by
  879.           a  consonant  [length].   (For a justification of this analysis, see
  880.           David Weber and Peter Landerman "The Interpretation of  Long  Vowels
  881.           in Quechua" IJAL, January 1985, pages 94-108.)  In order that SYLCHK
  882.           treat long vowels in this way, the words are normalized by  changing
  883.           "aa"  to  "a:"; "ee" to "e:"; and so on, and ":" is listed as a coda
  884.           in the ONC file.  The format  of  an  orthography  change  table  is
  885.           described  below  in  section 3.5. If an orthography change table is
  886.           specified, the program will respond with a message:
  887.  
  888.                   Orthography change table file: [None]
  889.  
  890.                   5 changes loaded.
  891.  
  892.           Now you are asked for the name of  the  file  that  indicates  which
  893.           specific  standard  format  fields  the program will check.  This is
  894.           done with the following prompt:
  895.  
  896.                Standard format marker field file: (<RETURN> for all fields
  897.  
  898.           See section 2.4 for a discussion of this  file.   If  you  want  all
  899.           fields,  simply  press the <RETURN> key.  Next you will be asked for
  900.           an output file:
  901.  
  902.                   Output file: [con]
  903.  
  904.           If  you  simply  type  a  carriage  return,  the  list  of  possible
  905.           misspelled words will be displayed on the terminal.  If you type the
  906.           appropriate device name to refer to your printer it will be  printed
  907.           (without creating a file).  If you type a file name, the result will
  908.           be written to that file.  Next, you are asked for  the  file  to  be
  909.           checked with the prompt
  910.  
  911.  
  912.  
  913.  
  914.           DOCUMENT PREPARATION AIDS                                         16
  915.  
  916.                   Input file:
  917.  
  918.                The program will then begin processing  the  text.   Each  time
  919.           SYLCHK  successfully decomposes a word into well-formed syllables, a
  920.           period will appear on the screen, enabling you to watch its rate  of
  921.           progress.  At the end you will see a summary like:
  922.  
  923.                   INPUT: 386 words.
  924.  
  925.                   73 possible errors in abcdef.ghi
  926.  
  927.           SYLCHK  allows multiple input files to be checked (with the same ONC
  928.           specifications, etc.).  You are asked:
  929.  
  930.                   Next input file (RETURN if no more):
  931.  
  932.           If you respond with a <RETURN> the program will  terminate  and  you
  933.           will return to the monitor.
  934.  
  935.           3.3 The form of the output
  936.  
  937.                The  output file will contain, for each file being checked, its
  938.           name, the potential errors found in that file  (with  each  possibly
  939.           misspelled word on a separate line), and following the last possible
  940.           error, the number of possible errors found in that file.
  941.  
  942.                   Possible errors in HGMK01.SFM
  943.                   akrarkran
  944.                   hanunn
  945.                   wais
  946.                   
  947.                   3 possible errors
  948.  
  949.           3.4 How to write the ONC file
  950.  
  951.                This file  informs  SYLCHK  of  the  characters  and  character
  952.           strings  that  are  acceptable  syllable  onsets,  nuclei and codas.
  953.           These  appear  in  five  sets,  corresponding   to   the   following
  954.           distribution classes:
  955.  
  956.                   first  = only in syllable onset (e.g., kw, sy, n~)
  957.                   second = only in syllable coda (e.g., length)
  958.                   third  = in either the onset or coda; if ambiguous,
  959.                            will be interpreted as onset (e.g., k, ch)
  960.                   fourth = in either the coda or onset; if ambiguous,
  961.                            will be interpreted as coda 
  962.                   fifth  = in the vocalic nucleus (e.g., a, e, i, o, u)
  963.  
  964.           Members  of  each set are mutually exclusive of all other sets, that
  965.           is, no phoneme can occur in more than one distribution  class.   The
  966.           third and fourth classes are listed as they are to solve the problem
  967.           of ambiguity:  how does one divide  words  that  are  of  the  CVCVC
  968.           pattern?   In the third set, onset or coda, phonemes are listed that
  969.           can occur as either onsets or codae.  If a member of this set occurs
  970.           as  the  middle C in a CVCVC pattern, the  program will interpret it
  971.           as an onset, that is, CV.CVC.   Likewise,  phonemes  listed  in  the
  972.           fourth  set,  coda  or  onset, will be interpreted as a coda if they
  973.           occur as the middle C in a CVCVC pattern, that is CVC.VC.
  974.  
  975.  
  976.  
  977.           Syllable-based Spelling Checking                                  17
  978.  
  979.                The beginning and ending of each  class  is  marked  by  a  "\"
  980.           (backslash).    (Thus,   the  file  should  contain  10  \'s.)   Any
  981.           characters outside of these  five  regions  is  treated  as  comment
  982.           (i.e.,  everything  before  the  first  "\",  between the second and
  983.           third, the fourth and fifth, the sixth and seventh, the  eighth  and
  984.           ninth,  or  following  after  the last "\" is comment.)  Within each
  985.           class, characters and character strings should be separated  one  or
  986.           more whitespace characters (tab, blank or carriage return).
  987.  
  988.                The  ONC  file  also  tells SYLCHK what are acceptable syllable
  989.           patterns  within  words.   Three  patterns  are  given.   The  first
  990.           describes  only  initial  syllables,  the third describes only final
  991.           syllables, and the  second  describes  all  medial  syllables.   The
  992.           parentheses  are  used  to  indicate a syllable, the square brackets
  993.           indicate an optional phoneme.   Be  certain  there  is  no  matching
  994.           parenthesis or square bracket missing.
  995.  
  996.                Here is a sample ONC file (used for Quechua):
  997.  
  998.                   NJSYL.ONC modified for SYLCHK v. 3. by Steve McConnel,
  999.                   12-Dec-86
  1000.                      ONSET ONLY \ dy br pr by b d dr f fw fy gy h hy kl j
  1001.                                   hw ky kw py pw rr sy ty n~ kr bl n~w   \
  1002.                       CODA ONLY \ :                                      \
  1003.                   ONSET OR CODA \ ch g k l ll m n p q r s sh t tr ts w y \
  1004.                   CODA OR ONSET \                                        \
  1005.                         NUCLEUS \ a e i o u  a' e' i' o' u'              \
  1006.                   
  1007.                   SYLLABLE PATTERNS ([O]N[C]) (ON[C]) (ON[C])
  1008.  
  1009.                Here  is  a  second  example  of  an  ONC file describing a the
  1010.           syllable pattern for To'abaita (Solomon Islands) where the only  two
  1011.           syllable shapes are V and CV.
  1012.  
  1013.                   ONC.TOB  by Linda Simons  December 1986
  1014.                      ONSET ONLY \ b d f g gw k kw ng ' l m n r s t th w \
  1015.                       CODA ONLY \ \
  1016.                   ONSET OR CODA \ \        considered onset if ambiguous
  1017.                   CODA OR ONSET \ \        considered coda if ambiguous
  1018.                         NUCLEUS \ a e i o u \
  1019.                   
  1020.                   SYLLABLE PATTERN ([O]N) ([O]N) ([O]N)
  1021.  
  1022.           You should not be unduly concerned about making this table complete.
  1023.           Create a first approximation with  those  characters  that  come  to
  1024.           mind, and try it out on a text.  It will then quickly become obvious
  1025.           which characters and character strings you need to add to the table.
  1026.  
  1027.           3.5 How to write an orthography change table    
  1028.  
  1029.                An orthography change table is a list of paired  strings,  each
  1030.           string  bounded  by  double  quotes (").  The first string of a pair
  1031.           specifies some pattern to be matched  in  a  text,  and  the  second
  1032.           string  specifies  what  is to be substituted for each occurrence of
  1033.           the matched string.  For example, the following is  the  table  used
  1034.           for Quechua mentioned above:
  1035.  
  1036.  
  1037.  
  1038.  
  1039.           DOCUMENT PREPARATION AIDS                                         18
  1040.  
  1041.                   LNGVWL.TAB  D. Weber  May-30-82
  1042.                   "aa" "a:"
  1043.                   "ee" "e:"
  1044.                   "ii" "i:"
  1045.                   "oo" "o:"
  1046.                   "uu" "u:"
  1047.  
  1048.           Observe the following in writing a change table:
  1049.  
  1050.                1. The changes may occur in any order,  that  is,  their  order
  1051.                   makes no difference in the effect on the text.
  1052.  
  1053.                2. All  changes  should  be  given  in  lower  case;  it is not
  1054.                   necessary to give a change with various capitalizations.
  1055.  
  1056.                3. Any line whose first printing  character  is  not  a  double
  1057.                   quote  is  treated as a comment. (Note, a space or tab could
  1058.                   an  effective  change,  since   these   are   not   printing
  1059.                   characters.)
  1060.  
  1061.                4. Any  characters  may  be  placed  between the left and right
  1062.                   strings.   This  allows  whatever  notation  you   like   to
  1063.                   symbolize  the  change;  the  following  lines have the same
  1064.                   effect:
  1065.  
  1066.                           "mispelled" becomes "misspelled"
  1067.                           "mispelled" --> "misspelled"
  1068.                           "mispelled" > "misspelled"
  1069.                           "mispelled" "misspelled"
  1070.  
  1071.                5. Anything following the right string is ignored, so  comments
  1072.                   may  follow  the pair of strings; for example, the following
  1073.                   three changes are effective:
  1074.  
  1075.                           "kachaka"       "alliya"        `get well'
  1076.                           "qo"            "qara"          `give'
  1077.                           "fiyupa"        "aliska"        `very much'
  1078.  
  1079.  
  1080.  
  1081.                      4. SYLLABLE-BASED SPELLING CORRECTION (SYLCOR)
  1082.  
  1083.           4.1 Introduction
  1084.  
  1085.                SYLCOR  is  a   program   for   correcting   misspellings   and
  1086.           typographical  errors in text.  SYLCOR identifies possible errors by
  1087.           judging the  phonological  well-formedness  of  each  word:  a  word
  1088.           possibly  has  an  error if it cannot be decomposed into one or more
  1089.           well-formed syllables.  SYLCOR assumes that a syllable is made up of
  1090.           an optional onset, a vocalic nucleus, and an optional coda; the user
  1091.           must supply a table of  these  for  the  language  to  which  he  is
  1092.           applying  SYLCOR.   (SYLCOR  cannot  be  applied in a language whose
  1093.           writing system does not approximate phonological form, for  example,
  1094.           Chinese.)
  1095.  
  1096.                Potential  errors  in text may be exceptions to whatever method
  1097.           is used to discover them.  For example, if error detection  for  the
  1098.           Quechua language is based on phonological well-formedness, then many
  1099.  
  1100.  
  1101.  
  1102.           Syllable-based Spelling Correction                                19
  1103.  
  1104.           words borrowed from  Spanish  are  exceptions.   SYLCOR  uses  lists
  1105.           (which  you  create  as  you corrects text) to skip such exceptional
  1106.           words.   You  might  have  a  list  of  loan  words,   a   list   of
  1107.           abbreviations, a list of Biblical names, or something else.
  1108.  
  1109.                Potential  errors  in  text  may be real errors.  SYLCOR allows
  1110.           these to be corrected.  Context is  sometimes  needed  to  determine
  1111.           what  the  correct  word  should  be.   For  example, if you were to
  1112.           encounter the misspelling "ther" out of context, you would not  know
  1113.           whether  it should be corrected to "their", "there", "other", "the",
  1114.           etc.  Therefore, each time an error is suspected, SYLCOR displays  a
  1115.           region of text surrounding the suspect word.
  1116.  
  1117.                For  many errors, you will simply want to correct the error and
  1118.           continue through the text.  For common errors, you may want to  have
  1119.           all  subsequent instances corrected automatically.  For example, you
  1120.           might  want  all  instances  of  "recieve"   to   become   "receive"
  1121.           automatically.   SYLCOR  allows  you  to  create  (in the process of
  1122.           correcting text) lists of automatic changes.  You may choose to have
  1123.           each  automatic  correction  presented  for  your approval before it
  1124.           modifies the text.
  1125.  
  1126.                When you begin a session  with  SYLCOR,  the  files  containing
  1127.           exceptions and auto-corrections are loaded.  At the end of each text
  1128.           corrected, for each file to which there have been additions, you are
  1129.           asked  if you would like to update the file or backup the additions.
  1130.           In this way,  the  files  may  be  enlarged  by  each  session,  and
  1131.           consequently you do less and less work in subsequent sessions.
  1132.  
  1133.                SYLCOR  may  be applied to many texts in one session.  For each
  1134.           input text file, a corresponding output file will be created.
  1135.  
  1136.                SYLCOR deals only with the words of the text,  and  deals  with
  1137.           them  only  one  at a time.  All the format marking, punctuation and
  1138.           capitalization are passed unchanged  from  the  input  text  to  the
  1139.           output text.
  1140.  
  1141.                As  mentioned  above,  SYLCOR uses phonological well-formedness
  1142.           for  detecting  potential  errors.   SYLCOR's  error   detector   is
  1143.           precisely  that  of  SYLCHK.  Both use the same data files, i.e. the
  1144.           same orthography normalization table and the same file of acceptable
  1145.           onsets,  nuclei and codae.  Before running SYLCOR, you might find it
  1146.           helpful to run SYLCHK on some text; this will help  you  to  develop
  1147.           the data you need in the tables.
  1148.  
  1149.                If  you  intend  to  put  words  into a new auto-corrections or
  1150.           exceptions file during a SYLCOR session, you must create these files
  1151.           before  you  run  SYLCOR.   The  files  may  be  empty,  but you are
  1152.           encouraged to place identifying comments in them, according  to  the
  1153.           syntax given below (see section 4.9).
  1154.  
  1155.           4.2 Initiating a session with SYLCOR
  1156.  
  1157.                After  giving  the  command to run SYLCOR you will see first an
  1158.           line showing you the amount of  available  memory.   Then  you  must
  1159.           respond  to  some  questions so that some files can be loaded and so
  1160.           that certain options may be set.  You are first asked  for  a  setup
  1161.           file with the prompt:
  1162.  
  1163.  
  1164.  
  1165.           DOCUMENT PREPARATION AIDS                                         20
  1166.  
  1167.                   Setup file: [none]
  1168.  
  1169.           If you do not have a  setup  file,  you  must  answer  a  series  of
  1170.           questions interactively at the terminal.  If you provide the name of
  1171.           a setup file, many of the subsequent questions will be answered from
  1172.           the  file,  and you will be free to seek the beverage of your choice
  1173.           while the files load.  The following is a sample setup file:
  1174.  
  1175.                   Setup file for using SYLCOR with To'abaita texts
  1176.                   '
  1177.                   2
  1178.                   1
  1179.                   autoco.tob
  1180.                   y
  1181.                   loan.tob
  1182.                   biblic.tob
  1183.                   
  1184.                   \
  1185.                   onc.tob
  1186.                   
  1187.                   fields.tob
  1188.  
  1189.           The first line will always be skipped; this allows you to provide an
  1190.           identifying  comment.   Subsequent  lines  provide  responses to the
  1191.           questions in the order the program asks  them  as  discussed  below.
  1192.           There  may  be from zero to four names of exceptions lists and after
  1193.           the last exception file is given there must a carriage  return.   If
  1194.           some  file  cannot be found, setting up becomes interactive, and you
  1195.           must provide the correct responses from  the  terminal  (unless  you
  1196.           want to abort SYLCOR, edit the setup file and try again). 
  1197.  
  1198.                After  being  asked  for  a  setup file, you will then be asked
  1199.           which characters  you  want  treated  as  alphabetic  characters  in
  1200.           addition to the standard ones:
  1201.  
  1202.                Press <RETURN> to include these as alphabetic characters: ~'
  1203.                Otherwise type the characters desired:
  1204.  
  1205.           All other characters will be regarded as occurring outside of words.
  1206.           For example if you wish to treat "oyo't"  as  a  word,  include  the
  1207.           apostrophe  (')  as  an  alphabetic character; otherwise SYLCOR will
  1208.           treat "oyo't" as the two words "oyo" and "t".   After  you  respond,
  1209.           SYLCOR  will  inform  you  of  the  characters  it  is  treating  as
  1210.           alphabetic.  For example, if you responded by typing a tilde (~) and
  1211.           an apostrophe ('), you will then see the following:
  1212.  
  1213.                   Using the following as alphabetics:
  1214.                   ~'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
  1215.  
  1216.                The  auto-corrections  and exceptions you are about to be asked
  1217.           for are stored in the computer's memory as a type of tree structure,
  1218.           called  a "trie."  Tries are more efficient than simple lists in two
  1219.           ways: (i) it is possible to find  entries  much  more  quickly,  and
  1220.           (ii)   for  large tables, more changes can be stored.  The degree to
  1221.           which this efficiency is attempted is set by the number you give  in
  1222.           response to the prompt:
  1223.  
  1224.                   Maximum level for trie [no limit]?
  1225.  
  1226.  
  1227.  
  1228.           Syllable-based Spelling Correction                                21
  1229.  
  1230.           If there were nothing to pay for the efficiency,  one  would  simply
  1231.           strive  for  the  maximum, responding always with a carriage return.
  1232.           But efficiency isn't free.  If the dictionary is not large enough to
  1233.           take  advantage  of  the  density you hope to achieve, more space is
  1234.           used than necessary.  (It's something like packaging soap in economy
  1235.           sized  boxes:  if  you don't fill them the result takes up more room
  1236.           than necessary.)
  1237.  
  1238.                As a rule of thumb, respond with 2 or 3 for tables with  up  to
  1239.           1000  entries.   You will probably develop a feel for what number is
  1240.           appropriate; you might even experiment, loading the same table  with
  1241.           different  numbers of levels and seeing which number leaves the most
  1242.           space (as reported by messages concerning free  space  given  before
  1243.           and  after  the  change table is loaded).  If you set the number too
  1244.           low (say 0 or 1 for over 500 entries) the time it takes to find each
  1245.           change will increase considerably.
  1246.  
  1247.                The next question the program asks is:
  1248.  
  1249.                   Minimum length of words to check: [1]
  1250.  
  1251.           Here  you should indicate the number of characters in the language's
  1252.           shortest well-formed words.
  1253.  
  1254.                Next you are asked:
  1255.  
  1256.                   Auto-corrections file: [none]
  1257.  
  1258.           If you do not want any  auto-corrections,  simply  type  a  carriage
  1259.           return.  If you have an auto-corrections table to load, respond with
  1260.           the appropriate file name.  If you do not have  an  auto-corrections
  1261.           file  and  you expect to put automatic corrections into such a file,
  1262.           go no further!  Use ^C to get back to the monitor and create a  file
  1263.           (using  a  text  editor).   (The structure of this file is described
  1264.           below in section 4.7.)  Run SYLCOR again, and when you get  to  this
  1265.           point,  respond  with  its  name.  The auto-corrections will then be
  1266.           added to this file.  After an auto-correction file  is  loaded,  you
  1267.           are told how many corrections were loaded.  Next comes the question:
  1268.  
  1269.                   Query before any auto-corrections? [y]
  1270.  
  1271.           If  you  respond  with  "n" or "N", auto-corrections are carried out
  1272.           automatically, without asking you to verify them.  The only evidence
  1273.           you  will  see  of  a  change is the incrementing of the "auto-corr"
  1274.           counter on the screen.  If you answer "y",  "Y"  or  simply  respond
  1275.           with  a  carriage  return,  then  each  time  an  auto-correction is
  1276.           discovered the surrounding text is displayed in the  upper  part  of
  1277.           the screen and your approval is sought.  For example:
  1278.  
  1279.                   "ther" > "their" ? [y]
  1280.  
  1281.           This   forces  you  to  decide  case-by-case  whether  a  change  is
  1282.           appropriate.   You  will   probably   want   to   be   queried   for
  1283.           auto-corrections  at  first;  if  you  find  that  you always answer
  1284.           positively, then you may feel comfortable about dispensing with  the
  1285.           warning.
  1286.  
  1287.  
  1288.  
  1289.  
  1290.           DOCUMENT PREPARATION AIDS                                         22
  1291.  
  1292.                After the auto-corrections query you  will  again  be  informed
  1293.           about  how much free memory is available.  Next you are asked for an
  1294.           exceptions file:
  1295.  
  1296.                   Exceptions file 1:
  1297.  
  1298.           If you respond to this with a carriage return,  SYLCOR  will  assume
  1299.           you  do  not  want  to  use  any  exceptions  files.   As  with  the
  1300.           auto-correction file, any exceptions files you wish to use  must  be
  1301.           created before reaching this point.  They need not have any entries,
  1302.           but  you  must  respond  to  this  prompt  with  the   name   of   a
  1303.           previously-created  file.   An  exceptions  file is simply a list of
  1304.           words, all lower case.  Its order is not significant.  It is good to
  1305.           have  it  begin  with  an  identifying  comment line.  (If this line
  1306.           begins with a backslash  ("\")  then  the  exceptions  file  can  be
  1307.           periodically sorted and the comment line will stay at the top.)
  1308.  
  1309.                After  Exceptions  file 1 has loaded, you will be told how many
  1310.           exceptions were loaded and informed about the amount of free storage
  1311.           by a message such as the following:
  1312.  
  1313.                   12963 bytes left, largest space is 6568 bytes.
  1314.  
  1315.           If  either  of  the numbers gets below 100, SYLCOR may have problems
  1316.           adding to the exceptions lists or auto-corrections table.
  1317.  
  1318.                If you have loaded an exceptions file, you will  be  asked  for
  1319.           another:
  1320.  
  1321.                   Exceptions file 2:
  1322.  
  1323.           You  can  use  up to four exceptions files during any run of SYLCOR.
  1324.           This allows you to keep, for example, Biblical names  in  one  file,
  1325.           linguistic  jargon  in another, unassimilated loan words in another,
  1326.           and so on.  Some applications will not need all  of  the  exceptions
  1327.           files;  for  instance,  correcting  Scripture  would  not  need  the
  1328.           linguistic jargon and correcting a linguistic paper would  not  need
  1329.           the  Biblical names. When the question appears again, press <RETURN>
  1330.           if you have no more exception files.
  1331.  
  1332.                Next you are asked :
  1333.  
  1334.                   Character which separates ONC distribution classes: [\]
  1335.  
  1336.           Next you are asked for an "ONC" table:
  1337.  
  1338.                   ONC file?
  1339.  
  1340.           The ONC file defines the possible syllable onsets, nuclei and codae.
  1341.           You  must  write  an  ONC  file  for  the  language to which you are
  1342.           applying SYLCOR; how to do so is discussed in the  previous  section
  1343.           on SYLCHK, section 3.4
  1344.  
  1345.                Next you are asked:
  1346.  
  1347.                   Orthography change table file: [none]
  1348.  
  1349.           If  you do not want to use a change table, simply press <RETURN>.  A
  1350.  
  1351.  
  1352.  
  1353.           Syllable-based Spelling Correction                                23
  1354.  
  1355.           change table allows you to normalize the spelling  of  words  before
  1356.           they  are  checked,  which  may be very useful.  For example, in the
  1357.           practical orthography for Quechua, long vowels  are  represented  as
  1358.           two  vowels, for example, long /a/ is represented as "aa".  However,
  1359.           in the phonological system, long vowels pattern as a vowel  followed
  1360.           by  a  consonant,  so  long  /a/  patterns  as  an /a/ followed by a
  1361.           consonant [length].  In order that SYLCOR treat long vowels in  this
  1362.           way,  the  words  are  normalized  by changing "aa" to "a:"; "ee" to
  1363.           "e:"; and so on, and ":" is listed as a coda in the ONC  file.   The
  1364.           format  of an orthography change table is described in detail in the
  1365.           preceding section on SYLCHK, section 3.5.  The next question is:
  1366.  
  1367.                Standard format marker field file: (<RETURN> for all fields)
  1368.  
  1369.                This file will list the specific standard  format  fields  that
  1370.           you  want  SYLCOR  to  read.   See the preceeding section on WRDCHG,
  1371.           section 2.4, for details of how this file should look.  Simply press
  1372.           <RETURN>  if  you want SYLCOR to read all fields.  Remember that all
  1373.           the answers to these questions  can  be  put  in  a  setup  file  as
  1374.           discussed already.
  1375.  
  1376.                At this point you will see a message on the screen and finally,
  1377.           you are asked for an input file:
  1378.  
  1379.                   Input file:
  1380.  
  1381.           To this you must respond with the name  of  the  file  you  wish  to
  1382.           correct.   If the file is not found, you will be asked to try again.
  1383.           When the file is found, you are asked for the  name  of  the  output
  1384.           file.   SYLCOR makes a default file name which you can use by simply
  1385.           typing a carriage return; the default writes to default  device  and
  1386.           adds  and  extension .SPL to the input file name.  Thus, if you were
  1387.           editing FUNNEY.SFM, the next prompt would be:
  1388.  
  1389.                   Output file: [FUNNEY.SPL]
  1390.  
  1391.           Of course, you are free to respond with whatever file name you wish.
  1392.           (On  a  two-tape  system, you will definitely want to have the input
  1393.           and output files on different tapes,  as  otherwise  there  will  be
  1394.           considerable tape spinning in the course of correcting a file.)
  1395.  
  1396.           4.3 Screen layout
  1397.  
  1398.                Suppose  you  initiate  a  session with SYLCOR in which you are
  1399.           correcting a file TEXT.SFM from the default device and  putting  the
  1400.           corrected version onto a specified device (such as DD1: or b:) under
  1401.           the name TEXT.SPL (where the new extension  indicates  that  it  has
  1402.           gone  through a spelling corrector).  The following appears slightly
  1403.           above the middle of the screen in reverse video:
  1404.  
  1405.           +-----------------------------------------------------------------+
  1406.           |SYLCOR TEXT.SFM > DD1:TEXT.SPL 0 words 0 Errors 0 Auto-corr 0 Exc|
  1407.           +-----------------------------------------------------------------+
  1408.  
  1409.           The region above these lines is for the display of text.  The region
  1410.           below  is  the  area  in which all your interactions with SYLCOR are
  1411.           displayed, that is, prompts and your  responses,  as  well  as  word
  1412.           editing.
  1413.  
  1414.  
  1415.  
  1416.           DOCUMENT PREPARATION AIDS                                         24
  1417.  
  1418.                As words pass through SYLCOR, the appropriate  counts  will  be
  1419.           incremented.   If you finish working on TEXT.SFM and correct another
  1420.           file, the new file names will be displayed and the counters will  be
  1421.           reset  to  zero.   Every  time  a  word passes from the input to the
  1422.           output file, the "words" counter gets incremented.  If the  word  is
  1423.           phonologically  anomalous, but is already on an exceptions list, the
  1424.           "Exc" counter is incremented.  If it is phonologically anomalous but
  1425.           there  is  an  auto-correction  for  it,  the "Auto-corr" counter is
  1426.           incremented.  If it is phonologically anomalous and there is neither
  1427.           an exception nor an auto-correction for it, then the "Error" counter
  1428.           is incremented.
  1429.  
  1430.           4.4 Handling possible errors: word edit mode
  1431.  
  1432.                When SYLCOR suspects an error, you  are  put  into  "word  edit
  1433.           mode."   The  word  is displayed in reverse video in the top part of
  1434.           the screen with surrounding text.  The following line  appears  just
  1435.           below the middle of the screen:
  1436.  
  1437.           WORD EDIT: <-,->, DEL, CTRL/U, CTRL/R, RETRN when done, ? for help
  1438.  
  1439.           Below  this  appears  the  word  you  are  editing,  with the cursor
  1440.           positioned directly after it.  You may  now  edit  this  word.   Any
  1441.           character you type will be entered to the left of the cursor, except
  1442.           for the following, which have the effect indicated:
  1443.  
  1444.           <- or CTRL/B moves the cursor back (to the left) one character
  1445.           -> or CTRL/F moves the cursor forward (to the right) one character
  1446.           DELETE or BACKSPACE  deletes one character to the left of the cursor
  1447.           CTRL/U or CTRL/W deletes the entire word being edited
  1448.           CTRL/R restores the original word, undoing all the editing
  1449.           RETURN closes the editing on this word
  1450.           ? prints this message
  1451.  
  1452.           If you hold down one of the arrow keys, it will move left  or  right
  1453.           until  you  release  the key.  If you are at the end of the word and
  1454.           move right, the cursor will cycle around to  the  beginning  of  the
  1455.           word.   If  you  are at the beginning of the word and move left, the
  1456.           cursor will cycle around to the end of the word.
  1457.  
  1458.                When you have finished  editing  a  word,  press  the  carriage
  1459.           return.   If  you  have  changed the word, the original word and the
  1460.           corrected form are displayed as a change, and you are asked  if  you
  1461.           want  to  make  this change automatic (by adding this to the list of
  1462.           automatic changes).  For example, if you  have  changed  "yeild"  to
  1463.           "yield", the following is displayed:
  1464.  
  1465.                   "yeild" > "yield" ? [n]
  1466.  
  1467.           The  "[n]"  at  the end of this line specifies the default value; if
  1468.           you respond simply with a carriage return, the change  will  not  be
  1469.           added  to the auto-corrections.  If you want to add this correction,
  1470.           respond with "y" or "Y".  After you respond to  this  question,  the
  1471.           program again resumes searching for the next possible error.
  1472.  
  1473.                Suppose that, instead of correcting the word, you want to leave
  1474.           it just as it is.  To do so, simply respond with a carriage  return.
  1475.           The  word  will then be unchanged, and you will be asked if you want
  1476.  
  1477.  
  1478.  
  1479.           Syllable-based Spelling Correction                                25
  1480.  
  1481.           to add it to one of the exceptions lists.  For example, if you  have
  1482.           two  exceptions  files,  LOANS.LST  and  BIBNAM.LST  (for  loans and
  1483.           Biblical names, respectively), you will see the following:
  1484.  
  1485.                   Add "xxxxx" to exceptions file?
  1486.                   1 - loan.lst
  1487.                   2 - bibnam.lst
  1488.                   <RETURN> to not save this exception
  1489.                   Type 1, 2, or <RETURN>
  1490.  
  1491.           To this you must respond with a "1", in which case the word will  be
  1492.           added  to LOANS.LST; a "2", in which case it is added to BIBNAM.LST;
  1493.           or a carriage  return,  in  which  case  it  is  not  added  to  any
  1494.           exceptions  list,  and  the  program  resumes searching for the next
  1495.           possible  error.   (The  program  will  complain  about  any   other
  1496.           response.)
  1497.  
  1498.           4.5 Making the auto-correction and exception files
  1499.  
  1500.                When you finish correcting a text file, and the output file has
  1501.           been written, you are then asked if you would like  to  protect  the
  1502.           additions  made  to  the auto-correction and exceptions files.  Only
  1503.           the files to which there have been  additions  will  be  considered.
  1504.           You are asked:
  1505.  
  1506.           Update auto-corr & all exceptions files to their current names? [n]
  1507.  
  1508.           If you respond with "y" or "Y", all files to which there have been
  1509.           additions are updated under the same name and onto the device from
  1510.           which  they  were  read.  Since this involves copying the original
  1511.           file  and  then  writing  out  the  additions,   this   can   take
  1512.           considerable time on a tape based system.
  1513.  
  1514.                If  you  respond negatively you are given the option to do so
  1515.           file by file.  You will see a prompt like the following:
  1516.  
  1517.                   For auto-corr file NJAUTO.TAB
  1518.                           1 - save both new and old auto-corrections
  1519.                           2 - save only new auto-corrections
  1520.                           <RETURN> to forget new auto-corrections
  1521.                           Type 1, 2, or <RETRUN>:
  1522.  
  1523.           This gives you  the  option  to  (1) rewrite  the  file  with  the
  1524.           additions  (which,  again,  takes  a while on a tape-based system)
  1525.           (2) write out a temporary  backup  file  consisting  of  only  the
  1526.           entries  you  have  added  since  your last update, (3) do nothing
  1527.           about backing up additions.  The  second  alternative  takes  less
  1528.           time,  but  in  the event of a problem (e.g., a power failure) you
  1529.           must later do a separate operation to append the additions to your
  1530.           original file.
  1531.  
  1532.                If  you  are  making  many  additions to the auto-correct and
  1533.           exceptions files, SYLCOR may ask you to  protect  these  additions
  1534.           before  it  gets  to  the end of the text file you are correcting.
  1535.           This is because SYLCOR has a limited ability to keep track of  all
  1536.           the  new  additions.   When  it gets to the limit, it wants you to
  1537.           rewrite the file with the additions (i.e.,  option  1,  above)  so
  1538.           that it can start afresh remembering new additions.  (Note: option
  1539.  
  1540.  
  1541.  
  1542.           DOCUMENT PREPARATION AIDS                                       26
  1543.  
  1544.           2 above will not do here, as it does not cause SYLCOR to  "forget"
  1545.           the old additions and start a new list.)
  1546.  
  1547.           4.6 Ending a session with SYLCOR
  1548.  
  1549.                SYLCOR  begins  the process of terminating a session when you
  1550.           respond with a carriage return to the following prompt:
  1551.  
  1552.                   Next input file (<RETURN> if no more):
  1553.  
  1554.           Since you may have done only temporary backup to this  point,  and
  1555.           would now like to do a full backup, you are again asked
  1556.  
  1557.           Update auto-corr & all exceptions files to their current names? [n]
  1558.  
  1559.           When the matter of backup is settled, you are asked to replace the
  1560.           systems tape if necessary and then type a carriage  return  before
  1561.           control returns to the operating system:
  1562.  
  1563.                   Reinsert system disk if necessary, then press <RETURN>:
  1564.  
  1565.           You will then be returned to the system prompt.
  1566.  
  1567.           4.7 Writing your own auto-correction and exceptions files
  1568.  
  1569.                It was said above that you must create the files used to hold
  1570.           auto-corrections and exceptions before you run  SYLCOR,  but  that
  1571.           when  you  create  them,  you need not put in any entries.  If you
  1572.           know beforehand some words you wish to include in these files, you
  1573.           might  as  well put them in with your editor.  Here we discuss the
  1574.           syntax of the auto-corrections and exceptions files.
  1575.  
  1576.                An auto-correction file has the same syntax as an orthography
  1577.           change  table  (as  defined  in  section 3.5).   Each  line should
  1578.           contain at most one correction.  The match string comes  first  on
  1579.           the  line,  followed  by the substitution.  Both are surrounded by
  1580.           double quotes.  Anything on a line outside the quotes is  ignored.
  1581.           Any  line  beginning  with any printing character besides a double
  1582.           quote is a comment line and is ignored.  Do  not  use  upper  case
  1583.           characters (except, perhaps, in comments)!  It is good to start it
  1584.           with an identifying comment line.  It can be  sorted  periodically
  1585.           with a line sort, and it can be used with WRDCHG.
  1586.  
  1587.                An auto-correction file does not need to have anything in it.
  1588.           Auto-corrections  can  be  added  to  it  by  using  it   as   the
  1589.           auto-corrections file of a SYLCOR session.  Thus, you can start an
  1590.           auto-corrections file simply by creating (with an editor) an empty
  1591.           file  or a file which simply contains an identifying comment line.
  1592.           Then you can add all the corrections in SYLCOR sessions.
  1593.  
  1594.                An exceptions file contains words,  one  per  line,  with  no
  1595.           quote  marks  or blanks.  Any line beginning with a non-alphabetic
  1596.           character is ignored and may be used for comments.  Again, do  not
  1597.           use upper case characters (except, perhaps, in comments)!
  1598.  
  1599.  
  1600.  
  1601.  
  1602.           Spelling Correction with Table Lookup                           27
  1603.  
  1604.                  5. A SPELLING CORRECTION WITH TABLE LOOKUP (SPLCOR)
  1605.  
  1606.                SPLCOR is a program for correcting potential misspellings and
  1607.           typographical errors in text.  SPLCOR may be applied to many texts
  1608.           in one session: for each input text file, a  corresponding  output
  1609.           file will be created.
  1610.  
  1611.                SPLCOR  deals only with the words of the text, and deals with
  1612.           them only one at a  time;  all  format  marking,  punctuation  and
  1613.           capitalization  are  passed  unchanged  from the input text to the
  1614.           output text.  It treats every word as a potential error unless the
  1615.           word  has been previously entered into an "exception" list.  It is
  1616.           possible to have up to four exceptions  lists;  for  example,  you
  1617.           might  have  a list of loan words, a list of abbreviations, a list
  1618.           of Biblical names, etc.
  1619.  
  1620.                SPLCOR allows real errors to be corrected.  Since context  is
  1621.           sometimes  needed  to determine what the correct word should be, a
  1622.           region of text surrounding the error is displayed.   For  example,
  1623.           if  you  were  to encounter the misspelling "ther" out of context,
  1624.           you would not know whether it  should  be  corrected  to  "their",
  1625.           "there", "other", "the", etc.
  1626.  
  1627.                For  many  errors,  you will simply want to correct the error
  1628.           and continue on through the text.  For common errors  though,  you
  1629.           may want to have all subsequent instances corrected automatically.
  1630.           For example, one might want all instances of "recieve"  to  become
  1631.           "receive"  automatically.   SPLCOR  allows  you  to create (in the
  1632.           process of correcting text) a list of automatic changes.  You  may
  1633.           choose to approve each automatic correction before it modifies the
  1634.           text or to have it applied without your approval.
  1635.  
  1636.                When a session with SPLCOR is initiated, the files containing
  1637.           exceptions  and  auto-corrections  are loaded.  At the end of each
  1638.           text corrected, you can refresh the tape or disk copies  of  these
  1639.           files.   In this way, they are enlarged by each session, so you do
  1640.           less and less work in subsequent sessions.
  1641.  
  1642.                A variant of SPLCOR, called SYLCOR, detects potential  errors
  1643.           on the basis of phonological well-formedness.  It is expected that
  1644.           in the future other spelling correctors will  be  available  which
  1645.           use  the  SPLCOR shell but have other error detection methods.  If
  1646.           you have entered (in the process of  correcting  text)  a  certain
  1647.           word, it will be passed as acceptable.
  1648.  
  1649.                For  the  details of running SPLCOR, see the documentation of
  1650.           SYLCOR (section 4).  Ignore  all  references  to  the  orthography
  1651.           normalization and ONC tables.  All other aspects of the SYLCOR are
  1652.           exactly as in SPLCOR.
  1653.  
  1654.  
  1655.  
  1656.                                6. HYPHENATION (HYPHEN)
  1657.  
  1658.           6.1 Introduction
  1659.  
  1660.                Discretionary  hyphens  are  symbols  in  a  text  file  that
  1661.           indicate  places  where  word  hyphenation at the end of a line is
  1662.  
  1663.  
  1664.  
  1665.           DOCUMENT PREPARATION AIDS                                       28
  1666.  
  1667.           allowed.  Just as in English we have rules about where  words  can
  1668.           be divided, vernacular languages do also.  Having these symbols in
  1669.           a text as we were working with it would  be  a  nuisance,  so  the
  1670.           HYPHEN  program  can be used to put them in just prior to printing
  1671.           or typesetting.  The discretionary hyphen character is read by the
  1672.           formatting  program  Manuscripter  (MS)  and signals that the word
  1673.           could be hyphenated there if it occurs at the end of a  line  when
  1674.           printing  takes  place.   This  feature  is  especially helpful in
  1675.           languages that contain many long words.  If hyphenation  were  not
  1676.           allowed, a lot of space would be wasted at the end of each line of
  1677.           print.
  1678.  
  1679.                The HYPHEN program is basically  language  independent.   The
  1680.           user  defines which segments or sequences of segments constitute a
  1681.           given syllabification class and then defines the hyphenation rules
  1682.           in  terms of these classes.  The user also defines which character
  1683.           sequences constitute overstrike units.
  1684.  
  1685.                In Spanish, for example, the class of consonants contains the
  1686.           segments  b,  l,  and r and the sequences br and bl.  The class of
  1687.           vowels contains the segments a, á, and i and the sequences ai  and
  1688.           ái.   One  hyphenation  rule in Spanish is VCV becomes V-CV.  Thus
  1689.           the sequence abri would be hyphenated as a-bri.
  1690.  
  1691.                The program also allows the user to specify where in the word
  1692.           hyphenation  is  to  begin  and  end.  Thus one can tell it to not
  1693.           start hyphenating until there are at least  4  characters  at  the
  1694.           beginning and to stop hyphenating when there are 3 characters left
  1695.           at the end.  This would override any hyphenation rules that  might
  1696.           apply near the word boundaries.
  1697.  
  1698.                HYPHEN  also  allows  one to specify to which standard format
  1699.           fields the hyphenation process is  to  apply.   In  a  dictionary,
  1700.           then,  one  can  have  separate  classes  and rules for the source
  1701.           language fields (such as \w and \i) and for  the  target  language
  1702.           fields (such as \d and \t).
  1703.  
  1704.                If  HYPHEN  finds  a  word that has any sequence that has not
  1705.           been defined, it will display an  error  message  on  the  screen.
  1706.           This message will show what the sequence is, what the word is, and
  1707.           will also state that the word will not be hyphenated.
  1708.  
  1709.           6.2 Data files
  1710.  
  1711.                HYPHEN uses four user-defined data files  which  need  to  be
  1712.           created with a text editor before running the program.
  1713.  
  1714.           6.2.1 Segment definition file
  1715.  
  1716.                This  file  contains  the  information  about  which segments
  1717.           and/or sequences belong to which classes.  The information  is  to
  1718.           be entered in a specified format.
  1719.  
  1720.                1. All  text up to the first occurrence of the word CLASS (or
  1721.                   class) at the beginning of a  line  is  considered  to  be
  1722.                   comment.
  1723.  
  1724.  
  1725.  
  1726.  
  1727.           Hyphenation                                                     29
  1728.  
  1729.                2. The word CLASS (or class)  at  the  beginning  of  a  line
  1730.                   indicates  that  a  new class is about to be defined.  The
  1731.                   one letter abbreviation for the class  should  follow  the
  1732.                   key  word  CLASS.   Any  other  text  after  that  will be
  1733.                   considered comment.
  1734.  
  1735.                3. From the next line to either the end of the file or to the
  1736.                   next  occurrence  of  the word CLASS at the beginning of a
  1737.                   line, all characters are considered to be either  segments
  1738.                   or sequences that belong to that class.
  1739.  
  1740.                4. Please note that no one unique sequence can belong to more
  1741.                   than one class.  Thus "a" cannot both belong to the  class
  1742.                   A and the class V.
  1743.  
  1744.                5. Also  note  that  HYPHEN  will  always  take  the  longest
  1745.                   possible sequence and assign its associated class  to  it.
  1746.                   As  an  example,  let's suppose that the following classes
  1747.                   are defined:
  1748.  
  1749.                           CLASS V
  1750.                             a ai i
  1751.                           CLASS C
  1752.                             n r t tr
  1753.                           CLASS M
  1754.                             ain
  1755.                   
  1756.                   Then the word "train" will be treated as  a  "CM"  pattern
  1757.                   and the word "trait" would be treated as a "CVC" pattern.
  1758.  
  1759.                The following shows an example from Campa Pajonal (a language
  1760.           of the Peruvian jungle). (Note that the front slash (/) and double
  1761.           quote  (")  preceding a vowel as well as the tilde (~) before an n
  1762.           represent overstrikes that a discussed in section 6.2.2.)
  1763.  
  1764.               Campa Pajonal segment definition file    hab  17-May-85
  1765.           
  1766.               CLASS V  Vowels
  1767.           
  1768.                   a  e  i  o  u
  1769.                   aa ee ii oo uu
  1770.                   ae oe
  1771.                   /a /e /i /o /u "u
  1772.           
  1773.               CLASS C  Consonants
  1774.           
  1775.                   c ch g j  jy m  my n ~n p py qu qy r ry
  1776.                   s sh t th ts ty tz v vy y
  1777.           
  1778.               CLASS N  Word medial nasal consonant clusters
  1779.           
  1780.                   mp  nqu nth ntz
  1781.                   mpy nqy nts
  1782.                   nc  nt  nty
  1783.                   nch
  1784.           
  1785.  
  1786.  
  1787.  
  1788.  
  1789.           DOCUMENT PREPARATION AIDS                                       30
  1790.  
  1791.           6.2.2 Overstrike unit file
  1792.  
  1793.                This file  lists  the  character  sequences  that  constitute
  1794.           overstrike  units.   That  is, it lists all sequences that will be
  1795.           printed  as  one  character  as  the  text  is  passed  through  a
  1796.           Consistent  Changes  print  table.   This  information  is used by
  1797.           HYPHEN to count correctly where to  begin  or  end  hyphenating  a
  1798.           word.  The sequences are to be entered in a specified format.
  1799.  
  1800.                1. The first line is treated as comment.
  1801.  
  1802.                2. All  following  text  is  considered  to  be a list of the
  1803.                   overstrike units.  Each unit should be separated by "white
  1804.                   space"  (i.e.,  a  space, a tab, or a new line).  Capitals
  1805.                   and lower case letters do not need to be distinguished.
  1806.  
  1807.           The following shows an example from Spanish.
  1808.  
  1809.                Overstrike definition file for Spanish  05-Jul-85 hab
  1810.           
  1811.                'a 'e 'i 'o 'u "u ~n
  1812.           
  1813.  
  1814.           6.2.3 Hyphenation change table
  1815.  
  1816.                This file contains  the  hyphenation  rules.   It  is  to  be
  1817.           written  in the form of a "change table," although it is different
  1818.           from a Consistent Changes table in several ways.
  1819.  
  1820.                A change table is a  list  of  paired  strings,  each  string
  1821.           bounded  by  double  quotes  (").   The  first string of a pair is
  1822.           called the  "match  string";  it  specifies  some  pattern  to  be
  1823.           matched.   The  second  string,  called the "substitution string,"
  1824.           specifies what is to be substituted for  each  occurrence  of  the
  1825.           matched   string.   Please  note  the  following  when  writing  a
  1826.           hyphenation change table:
  1827.  
  1828.                1. Any character(s) may be placed between the left and  right
  1829.                   strings.   This  allows  whatever  notation  you  like  to
  1830.                   symbolize the change.  The following lines have  the  same
  1831.                   effect:
  1832.  
  1833.                           "VCV" becomes "V-CV"
  1834.                           "VCV" --> "V-CV"
  1835.                           "VCV" > "V-CV"
  1836.                           "VCV" "V-CV"
  1837.                   
  1838.  
  1839.                2. Anything   following  the  right  string  is  ignored,  so
  1840.                   comments may follow the pair of strings.
  1841.  
  1842.                3. If a character other than space or tab appears on  a  line
  1843.                   before  the  first  double  quote  mark, then that line is
  1844.                   regarded as a comment, and any change on  that  line  will
  1845.                   not  be  applied.   This  provides  a simple mechanism for
  1846.                   disabling a change: simply put some character ahead of the
  1847.                   first  string.   For example, the following line would not
  1848.                   make any change:
  1849.  
  1850.  
  1851.  
  1852.           Hyphenation                                                     31
  1853.  
  1854.                           off "VCV" > "V-CV"
  1855.  
  1856.                4. The hyphenation rules are ordered and will be  applied  as
  1857.                   many  times as possible.  That is, the first change in the
  1858.                   table will be made until it cannot be made anymore.   Then
  1859.                   the  second  change  will be made and so on.  This feature
  1860.                   has great  advantages,  but  can  cause  problems  if  not
  1861.                   properly  used.  It is possible to create an infinite loop
  1862.                   with this table!  Consider the following changes, where  C
  1863.                   is  the class of consonants, V is the class of vowels, and
  1864.                   G is the class of the single segment glottal.
  1865.  
  1866.                           "CCC" > "Cc-C"
  1867.                           "CC"  > "C-C"
  1868.                           "VG"  > "Vg-"
  1869.                   
  1870.                   Note the order of the changes.  If  the  double  consonant
  1871.                   change  were  put  first,  it  would  never  see  a triple
  1872.                   consonant change (CCC would become C-CC  and  then  become
  1873.                   C-C-C).   Note that the first change converts the second C
  1874.                   to a lower case c.  This is  so  that  after  CCC  becomes
  1875.                   Cc-C, the second rule will not then convert the CC to C-C.
  1876.                   Also note that this same "trick" was applied  for  the  VG
  1877.                   change.   Without  it,  we would have an infinite loop: VG
  1878.                   would become VG- which then becomes VG--, and so on.
  1879.  
  1880.                5. The special symbol #  indicates  a  word  boundary.   Thus
  1881.                   "#CV"   indicates  word-initial  CV  and  "CV#"  indicates
  1882.                   word-final CV.
  1883.  
  1884.                Please note the following special restrictions on the above:
  1885.  
  1886.                1. There must be  a  one-to-one  correspondence  between  the
  1887.                   number  of  non-hyphen  characters in the match string and
  1888.                   the substitution string.  Thus the following will  produce
  1889.                   unpredictable results:
  1890.  
  1891.                           "AI" > "V"  (too few  char's in sub. string)
  1892.                           "C"  > "TR" (too many char's in sub. string)
  1893.                   
  1894.  
  1895.                2. When  word  boundary conditions are indicated in the match
  1896.                   string, the substitution string should  also  include  the
  1897.                   word boundary symbol (#):
  1898.  
  1899.                           "#VCV" > "#V-CV"
  1900.                           "VCV#" > "VC-V#"
  1901.                   
  1902.  
  1903.           6.2.4 Stardard format marker field file
  1904.  
  1905.                This  file  allows  the user to specify which standard format
  1906.           fields (in a text containing several fields) are to be hyphenated.
  1907.           Merely  list  the  format  markers  which indicated the fields the
  1908.           hyphenation rules are to apply.  They can be entered in  any  way.
  1909.           Any  text  that  is  not preceeded by a backslash character (\) is
  1910.           considered to be a comment.  The following could be an example for
  1911.           a dictionary:
  1912.  
  1913.  
  1914.  
  1915.           DOCUMENT PREPARATION AIDS                                       32
  1916.  
  1917.               Pajonl.sfm  Campa Pajonal std format marker field file
  1918.           
  1919.                   \w words
  1920.                   \i illustrative sentences
  1921.           
  1922.           Please note that this file is optional.  If no file  is  specified
  1923.           when the program is run, all fields will be used.
  1924.  
  1925.           6.3 Running the program
  1926.  
  1927.                When  HYPHEN is first run, it begins by indicating the amount
  1928.           of free memory available with a message like:
  1929.  
  1930.                   HYPHENATION Version 1.3 (12-Dec-86)
  1931.                     
  1932.                           SETUP-ALLOC-112832 bytes for records
  1933.  
  1934.           You are then asked to specify which non-alphabetic (i.e., anything
  1935.           other than a-z) characters are included as specifying words.
  1936.  
  1937.                Press <RETURN> to include these as alphabetic characters: ~'
  1938.                Otherwise type the characters desired:
  1939.  
  1940.           If, for example, you were using ' for accent, ~n for an enyee, and
  1941.           "u for a dieresis u, you would want to type:
  1942.  
  1943.                   '"~
  1944.           
  1945.           and then press the <RETURN> key.  HYPHEN will then inform  you  of
  1946.           the  characters  it  will  treat  as alphabetic (i.e., are used in
  1947.           forming a word).  Any other characters will be  considered  to  be
  1948.           punctuation.   For  example,  if  you  used the example above, the
  1949.           following will be displayed:
  1950.  
  1951.                   Using the following as alphabetics:
  1952.                   '"~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
  1953.  
  1954.           It now asks a series of three questions about  how  to  hyphenate.
  1955.           The first is:
  1956.  
  1957.                   Discretionary hyphen character: [&]
  1958.           
  1959.           Type  the  character  you wish to use for the discretionary hyphen
  1960.           and press the <RETURN> key.  It will assume that you want  to  use
  1961.           an  ampersand  (&)  if you just press the <RETURN> key.  Note that
  1962.           you will also have to inform Manuscripter of the character you use
  1963.           for your discretionary hyphen symbol (with the .dh command).  Note
  1964.           that a two-character sequence may also be used (e.g., [-  as  used
  1965.           by SIL's Printing Arts Department in Dallas for typesetting).  The
  1966.           second question is:
  1967.  
  1968.                   Hyphenation starts after this many characters: [2]
  1969.           
  1970.           Enter  the  minimum  number  of  characters  in  a  word  that  is
  1971.           acceptable  for  hyphenation  to begin and press the <RETURN> key.
  1972.           It will assume you want it to begin after at least two  characters
  1973.           if you just hit the <RETURN> key.  The third question is:
  1974.  
  1975.  
  1976.  
  1977.  
  1978.           Hyphenation                                                     33
  1979.  
  1980.                Hyphenation stops at this many characters from the end: [2]
  1981.           
  1982.           Enter the number desired and press  the  <RETURN>  key.   It  will
  1983.           assume  that  you  want  2 characters if you just hit the <RETURN>
  1984.           key.  Now it asks for the files that you have created as discussed
  1985.           in section 6.2.  The first one is:
  1986.  
  1987.                   Segment definition file:
  1988.           
  1989.           Enter the name of your file and press the <RETURN> key.  Secondly,
  1990.           it asks:
  1991.  
  1992.                   Overstrike unit file: (<RETURN> for no overstrike units)
  1993.           
  1994.           If you have a file specifying which character sequences constitute
  1995.           one  printing  segment, enter its name and press the <RETURN> key.
  1996.           If there are no such sequences, merely  press  the  <RETURN>  key.
  1997.           Note that if you have overstike characters in your text but do not
  1998.           specify them here, HYPHEN may not correctly  delete  discretionary
  1999.           hyphens too near the front or too near the end of a word.  Then it
  2000.           will ask:
  2001.  
  2002.                   Hyphenation change table:
  2003.           
  2004.           Enter the file name of your change table and  press  the  <RETURN>
  2005.           key.   After  it  has  loaded  the  file, it will display how many
  2006.           changes it found.  It will now ask:
  2007.  
  2008.                Standard format marker field file: (<RETURN> for all fields)
  2009.           
  2010.           If you have a file specifying which standard format fields are  to
  2011.           be  hyphenated, enter its name and press the <RETURN> key.  If you
  2012.           want to hyphenate the entire text, merely press the <RETURN>  key.
  2013.           It now asks:
  2014.  
  2015.                   Input file:
  2016.           
  2017.           Enter  the  name  of  the  text file you wish to be hyphenated and
  2018.           press the <RETURN> key.  Then it asks:
  2019.  
  2020.                   Output file: [xxxxxx.hyp]
  2021.           
  2022.           where xxxxxx represents the name given for the  input  text  file.
  2023.           Enter  the  name  you  want  for the hyphenated file and press the
  2024.           <RETURN> key.  If you just press the  <RETURN>  key,  HYPHEN  will
  2025.           write  your file on the default device using an extension of .hyp.
  2026.           After it has processed the file, it will  display  the  number  of
  2027.           words it processed and then ask:
  2028.  
  2029.                   Next input file: (<RETURN> if no more)
  2030.           
  2031.           Enter  the  name of any additional files to be hyphenated or press
  2032.           the <RETURN> key.
  2033.  
  2034.           6.4 Examples
  2035.  
  2036.                Following are three examples from  Peruvian  languages.   The
  2037.  
  2038.  
  2039.  
  2040.           DOCUMENT PREPARATION AIDS                                       34
  2041.  
  2042.           explanation of the rules, the hyphenation change  table,  and  the
  2043.           segment definition file are shown for each.
  2044.  
  2045.           6.4.1 Spanish
  2046.  
  2047.           6.4.1.1  Hyphenation   rules.  These   are   from  The  New  World
  2048.           SPANISH-ENGLISH  and   ENGLISH-SPANISH   Dictionary,   edited   by
  2049.           Salavatore Ramondino (Signet Books, 1969), pp. 553-554.
  2050.  
  2051.                                       Consonants
  2052.  
  2053.                1. ch,   ll,  rr  count  as  single  letters  and  are  never
  2054.                   separated:
  2055.  
  2056.                           pe-cho  o-lla  pe-rro
  2057.  
  2058.                2. Single consonants between vowels go with the second vowel:
  2059.  
  2060.                           ca-be-za  pa-re-cer
  2061.  
  2062.                3. The groups pr, pl, br, bl, fr, fl, tr, dr, cr, cl, gr,  gl
  2063.                   go with the following vowel and are never separated:
  2064.  
  2065.                           re-pri-mir  co-pla  te-cla
  2066.  
  2067.                4. In  other  groups  of two consonants, whether identical or
  2068.                   different,  the  consonants  are   divided   between   the
  2069.                   preceeding and the following vowel:
  2070.  
  2071.                           res-pi-ro  hon-ra  ac-ción  in-no-ble  at-las
  2072.  
  2073.                5. In  groups  of three consonants, the first two go with the
  2074.                   preceding vowel and the third with the following vowel:
  2075.  
  2076.                           ins-tin-to  obs-tá-cu-lo
  2077.  
  2078.                   Exception: the groups listed in 3 above are not separated:
  2079.  
  2080.                           en-tre  com-pra  tem-plo  ins-tru-men-to
  2081.  
  2082.                                         Vowels
  2083.  
  2084.                6. In any combination of two of a, e, or o, the  syllable  is
  2085.                   divided between the two vowels:
  2086.  
  2087.                           ca-o-ba  i-de-a-ción
  2088.  
  2089.                7. In  any combination of two vowels in which one is a, e, or
  2090.                   o and the other is i or u, and there is no accent mark  on
  2091.                   the  i  or  u,  the  vowels  form  a diphthong and are not
  2092.                   separated:
  2093.  
  2094.                           jo-fai-na  vian-da  em-bau-car  men-guan-te
  2095.                           vi-rrei-na  con-tien-da  en-deu-dar-se  con-sue-lo
  2096.                           co-loi-dal  na-cio-nal  duo-de-no
  2097.  
  2098.                   If there is an accent mark on the a, e, or o of the group,
  2099.  
  2100.  
  2101.  
  2102.           Hyphenation                                                     35
  2103.  
  2104.                   the  two  vowels  still  form  a  diphthong  and  are  not
  2105.                   separated:
  2106.  
  2107.                           es-táis  es-co-géis  cuán-do
  2108.  
  2109.                   If  the  accent mark falls on the i or u of the group, the
  2110.                   two vowels do not form a diphthong and are separated:
  2111.  
  2112.                           ca-í-da  pen-sa-rí-a-mos  a-ta-úd  re-ú-ne
  2113.  
  2114.                8. In any combination of i and u,  that  is,  ui  or  iu,  no
  2115.                   division  of  syllables  is made between these two vowels.
  2116.                   This holds whether there is an accent mark or not:
  2117.  
  2118.                           ciu-dad  rui-do ca-suís-ti-co
  2119.  
  2120.                9. In any combination of three vowels in which the first  one
  2121.                   is  i, u, or ü (more than three do not occur), there is no
  2122.                   division of syllables between any two vowels of the group.
  2123.                   This  holds  whether there is an accent mark on any of the
  2124.                   vowels or not:
  2125.  
  2126.                           a-pre-ciáis
  2127.  
  2128.                These rules can be simplified to  the  following  hyphenation
  2129.           rules and segment defintions.
  2130.  
  2131.           6.4.1.2  Segment  definition  file.   Table  1  shows  the segment
  2132.           definition file needed for Spanish.
  2133.  
  2134.                Spanish segment definition file    hab/sp  08-Jul-85
  2135.                
  2136.                        This data is from The New Word SPANISH-ENGLISH and
  2137.                        ENGLISH-SPANISH dictionary, ed. by Salvatore
  2138.                Ramondino,
  2139.                        1969, pp. 553-4 (V. Division of Syllables in
  2140.                Spanish).
  2141.                
  2142.                CLASS C  Consonants
  2143.                
  2144.                        b  bl br c  ch cl cr d  dr f  fl fr g  gl gr h  j  k
  2145.                        l  ll m  n  ~n p  pl pr qu r  rr s  t  tr v  x  z  y
  2146.                
  2147.                CLASS V  Vowels
  2148.                
  2149.                         a   e   i   o   u
  2150.                        'a  'e  'i  'o  'u
  2151.                
  2152.                        ai  ia  ei  ie  oi  io  ui  iu  "u'e
  2153.                        au  ua  eu  ue  ou  uo  "ue "ui "u'i
  2154.                
  2155.                        'ai i'a 'ei i'e 'oi i'o 'ui i'u
  2156.                        'au u'a 'eu u'e 'ou u'o
  2157.                
  2158.                        'iu u'i
  2159.                
  2160.                        i'ai i'ei u'ai u'ei "u'ei
  2161.                
  2162.  
  2163.  
  2164.  
  2165.           DOCUMENT PREPARATION AIDS                                       36
  2166.  
  2167.                        uia ui'a uio ui'o uie ui'e
  2168.                
  2169.  
  2170.                               Table 1 - Spanish segments
  2171.  
  2172.  
  2173.           6.4.1.3  Overstrike unit file.  Table 2 shows the overstrike  unit
  2174.           file  needed  for  Spanish.   An  accented  vowel is preceded by a
  2175.           single quote ('), a dieresis on a u is indicated by a double quote
  2176.           ("), and an enyee is indicated by a tilde (~n).
  2177.  
  2178.                Overstrike definition file for Spanish  05-Jul-85 hab
  2179.                
  2180.                'a 'e 'i 'o 'u "u ~n
  2181.  
  2182.                             Table 2 - Spanish overstrikes
  2183.  
  2184.           6.4.1.4  Hyphenation  change table.  Table 3 shows the hyphenation
  2185.           change table needed for Spanish.
  2186.  
  2187.                Spanish hyphenation rules    hab   17-May-85
  2188.                
  2189.                "VCV"   > "V-CV"
  2190.                "CCC"   > "Cc-C"
  2191.                "CC"    > "C-C"
  2192.                "VV"    > "V-V"
  2193.  
  2194.                           Table 3 - Spanish hypenation rules
  2195.  
  2196.  
  2197.           6.4.2  Amarakaeri
  2198.  
  2199.                This is a Peruvian  jungle  language  which  belongs  to  the
  2200.           Harakmbet language family.
  2201.  
  2202.           6.4.2.1  Hyphenation    rules.  Amarakaeri   has   the   following
  2203.           hyphenation rules (as provided by  Bob Tripp):
  2204.  
  2205.                1. When a sequence of vowel-consonant-vowel occurs,  a  break
  2206.                   may  be  made  following  the first vowel, except when the
  2207.                   consonant is d, g, or y.
  2208.  
  2209.                        ya-ti-huad
  2210.                   
  2211.                   When a vowel is followed by a glottal, the break  is  made
  2212.                   after the glottal.
  2213.  
  2214.                        o'-hua'-po
  2215.                   
  2216.                   When  a  sequence of vowel-consonant-glottal-vowel occurs,
  2217.                   the break is made between the consonant and the glottal.
  2218.  
  2219.                        mo'-en-'uy-ne  on'-haudiay-'uya-te
  2220.                   
  2221.  
  2222.                2. A break may be made between two consonants.
  2223.  
  2224.  
  2225.  
  2226.  
  2227.           Hyphenation                                                     37
  2228.  
  2229.                        arat-but  yan-nig-pee'
  2230.                   
  2231.                   The digraph hu should not be broken.
  2232.  
  2233.                        hua-hue'    pak-hue'
  2234.                        huey-pa     jo-nan-hua-hua-hue'
  2235.                   
  2236.                   When a glottal occurs between two  consonants,  the  break
  2237.                   should be made after the glottal.
  2238.  
  2239.                        On'-ka'-a-po   on'-no-kie'-uy
  2240.                        on'-tia-huay-po
  2241.                   
  2242.  
  2243.                3. A break may be made between two vowels.
  2244.  
  2245.                        o'-e-a-po  hua-e'-e-ri
  2246.                   
  2247.                   However, the vowel clusters oe, oe, ee, ae, ia, ie, io, io
  2248.                   should not be broken.
  2249.  
  2250.                        no-poe'-dik  on'-no-po'-toe-po
  2251.                        tia-huay-hued   be-tio-ka'
  2252.                   
  2253.                   When a cluster of three vowels occurs, break following the
  2254.                   second vowel.
  2255.  
  2256.                        a'-nig-pei-a'-po  mo'-ma-noe-an-hua-hui-ka'-a-po-ne
  2257.                   
  2258.                   In  any  vowel cluster including a glottal, a break may be
  2259.                   made after the glottal.
  2260.  
  2261.                        ij-no-poe-a'-a-po'i  hua-e'-e-ri  aro'-en
  2262.  
  2263.                4. Do not hyphenate leaving a single letter at the  beginning
  2264.                   or end of a word.
  2265.  
  2266.           6.4.2.2  Segment  definition  file.  Table  4  shows  the  segment
  2267.           definition file needed for Amarakaeri.  An  underscored  vowel  is
  2268.           indicated by a closing brace (}) preceding the vowel.
  2269.  
  2270.                
  2271.                Amarakaeri segment definition file   hab 15-May-85
  2272.                
  2273.                CLASS C  Consonants
  2274.                        b c f h hu j k l m n p q r s t v w x z
  2275.                
  2276.                CLASS X  Exception consonants
  2277.                        d g y
  2278.                
  2279.                CLASS G  Glottal
  2280.                        '
  2281.                
  2282.                CLASS V  Vowels
  2283.                         a  e  i  o  u
  2284.                        }a }e }i }o }u
  2285.                        }o}e }e}e }a}e ia }i}e io }i}o
  2286.                        oe
  2287.  
  2288.  
  2289.  
  2290.           DOCUMENT PREPARATION AIDS                                       38
  2291.  
  2292.                             Table 4 - Amarakaeri segments
  2293.  
  2294.  
  2295.           6.4.2.3  Overstrike unit file.  Table 5 shows the overstrike  unit
  2296.           file  needed for Amarakaeri.  An underscored vowel is indicated by
  2297.           a closing brace (}) preceding the vowel.
  2298.  
  2299.                Overstrike definition file for Amarakaeri   06-Jul-85 hab
  2300.           
  2301.                }a }e }i }o }u
  2302.           
  2303.  
  2304.                            Table 5 - Amarakaeri overstrikes
  2305.  
  2306.  
  2307.           6.4.2.4  Hyphenation change table.  Table 6 shows the  hyphenation
  2308.           change table needed for Amarakaeri.
  2309.  
  2310.                
  2311.                Amarakaeri Hyphenation Change Table  hab  15-May-85
  2312.                
  2313.                "VCV"   >       "V-CV"
  2314.                "VCGV"  >       "VC-GV"
  2315.                "VXGV"  >       "VX-GV"
  2316.                "CC"    >       "C-C"
  2317.                "XC"    >       "X-C"
  2318.                "CX"    >       "C-X"
  2319.                "XX"    >       "X-X"
  2320.                "CGC"   >       "CG-C"
  2321.                "CGX"   >       "CG-X"
  2322.                "XGC"   >       "XG-C"
  2323.                "XGX"   >       "XG-X"
  2324.                "VGV"   >       "Vg-V"
  2325.                "VG"    >       "Vg-"
  2326.                "VVV"   >       "Vv-V"
  2327.                "VVGV"  >       "Vvg-V"
  2328.                "VV"    >       "V-V"
  2329.  
  2330.                         Table 6 - Amarakaeri hyphenation rules
  2331.  
  2332.  
  2333.           6.4.3  Campa Pajonal
  2334.  
  2335.                Campa  Pajonal is a Peruvian jungle language which belongs to
  2336.           the Arawakan language family.
  2337.  
  2338.           6.4.3.1  Hyphenation rules.  These rules were provided  by  Allene
  2339.           Heitzman.
  2340.  
  2341.                1. The  vowels  are:  a,  e,  i,  o, and length, written as a
  2342.                   geminate vowel, and the vowel clusters ae, and oe.
  2343.  
  2344.                2. The consonants are: c, ch, g, j, jy, m, my, n, ñ,  p,  py,
  2345.                   qu, qy, r, ry, s, sh, t, th, ts, ty, tz, v, vy, y.
  2346.  
  2347.                3. The  consonant  clusters  are (word medial only): mp, mpy,
  2348.                   nc, nch, nqu, nqy, nt, nth, nts, nty, ntz.
  2349.  
  2350.  
  2351.  
  2352.  
  2353.           Hyphenation                                                     39
  2354.  
  2355.                4. Break after any vowel preceeding a consonant except before
  2356.                   an m or n in a consonant cluster.
  2357.  
  2358.                5. Do not break off less than four letters.
  2359.  
  2360.           6.4.3.2  Segment  definition  file.  Table  7  shows  the  segment
  2361.           definition file needed for Campa Pajonal.
  2362.  
  2363.                
  2364.                Campa Pajonal segment definition file    hab  17-May-85
  2365.                
  2366.                CLASS V  Vowels
  2367.                
  2368.                        a  e  i  o 
  2369.                        aa ee ii oo
  2370.                        ae oe
  2371.                        /a /e /i /o 
  2372.                
  2373.                CLASS C  Consonants
  2374.                
  2375.                        c ch g j  jy m  my n ~n p py qu qy r ry
  2376.                        s sh t th ts ty tz v vy y
  2377.                
  2378.                CLASS N  Word medial nasal consonant clusters
  2379.                
  2380.                        mp  nqu nth ntz
  2381.                        mpy nqy nts
  2382.                        nc  nt  nty
  2383.                        nch
  2384.  
  2385.                            Table 7 - Campa Pajonal segments
  2386.  
  2387.  
  2388.           6.4.3.3  Overstrike unit file.  Table 8 shows the overstrike  unit
  2389.           file needed for Campa Pajonal.  An accented vowel is preceded by a
  2390.           single slash (/), and an enyee is indicated by a tilde (~n).
  2391.  
  2392.                   
  2393.                   Overstrike definition file for Campa Pajonal  06-Jul-85
  2394.                   hab
  2395.                   
  2396.                   /a /e /i /o ~n
  2397.                   
  2398.                          Table 8 - Campa Pajonal overstrikes
  2399.  
  2400.  
  2401.           6.4.3.4  Hyphenation change table.  Table 9 shows the  hyphenation
  2402.           change table needed for Campa Pajonal.
  2403.  
  2404.  
  2405.  
  2406.  
  2407.           DOCUMENT PREPARATION AIDS                                       40
  2408.  
  2409.                
  2410.                Campa Pajonal hyphenation rules    hab   17-May-85
  2411.                
  2412.                "VC" > "V-C"    c break after any vowel preceding
  2413.                                  a consonant
  2414.                                c do not break if it is an m or n
  2415.                                  in a consonant cluster
  2416.                
  2417.  
  2418.                       Table 9 - Campa Pajonal hyphenation rules
  2419.  
  2420.           6.5 Miscellaneous
  2421.  
  2422.           6.5.1 Program limitations
  2423.  
  2424.                While HYPHEN is quite general, it does have some limitations.
  2425.  
  2426.                1. If a text has a mixture  of  vernacular  and  loan  words,
  2427.                   HYPHEN  will  try to hyphenate the loan words according to
  2428.                   the rules of the vernacular.  If the  loan  word  contains
  2429.                   some   undefined  sequence,  then  HYPHEN  will  ring  the
  2430.                   terminal bell and display an error message  for  the  word
  2431.                   and   will   not   hyphenate  it.   (This  is  actually  a
  2432.                   fundamental problem of identifying  loan  words  within  a
  2433.                   text).
  2434.  
  2435.                2. In version 1.2, HYPHEN correctly handles a text containing
  2436.                   Manuscripter bar commands (such as |b   or  |u).   Earlier
  2437.                   versions used to treat the b or u as a part of the word to
  2438.                   be hyphenated and it would lose any  capitalization  of  a
  2439.                   word preceded by a bar command.
  2440.  
  2441.                3. HYPHEN  assumes  that  the  orthography  consists  only of
  2442.                   lowercase alphabetics.  Thus it is not able  to  tell  the
  2443.                   difference  between upper and lower case letters, even if,
  2444.                   say  capital  letters  were  used  to  represent  unvoiced
  2445.                   vowels.   Both will be treated as if they were lower case.
  2446.                   In order for HYPHEN to correctly  handle  this  situation,
  2447.                   one  will  need  to  represent  the unvoiced sound by some
  2448.                   other unique sequence.
  2449.  
  2450.           6.5.2 Testing method
  2451.  
  2452.                The following is a method one can use to test  one's  segment
  2453.           definition file and hyphenation change table.
  2454.  
  2455.                1. Create a file that consists of the example words listed in
  2456.                   the hyphenation rules.  Put each word on a separate line.
  2457.  
  2458.                2. Then make two copies of each word, each one on a  separate
  2459.                   line.
  2460.  
  2461.                3. Place   a  backslash  character  in  front  of  the  first
  2462.                   occurrence  and  insert  hyphens  where  they  should  go.
  2463.                   HYPHEN  will  then  treat this as a standard format marker
  2464.                   and not as a word.
  2465.  
  2466.  
  2467.  
  2468.  
  2469.           Hyphenation                                                     41
  2470.  
  2471.                4. Insert a space in front of the second word.
  2472.  
  2473.                5. Run the file through the HYPHEN program  and  examine  the
  2474.                   results.   If  hyphenation has occurred correctly, the two
  2475.                   occurences of the word will line up exactly.
  2476.  
  2477.           Here is an example of part of such a test file for Spanish.
  2478.  
  2479.                   \o-lla
  2480.                    olla
  2481.                   \ca-be-za
  2482.                    cabeza
  2483.                   \re-pri-mir
  2484.                    reprimir
  2485.                   \co-pla
  2486.                    copla
  2487.                   \te-cla
  2488.                    tecla
  2489.                   \res-pi-ro
  2490.                    respiro
  2491.                   \obs-t'a-cu-lo
  2492.                    obst'aculo
  2493.           The output would then look like this:
  2494.  
  2495.                   \o-lla
  2496.                    o-lla
  2497.                   \ca-be-za
  2498.                    ca-be-za
  2499.                   \re-pri-mir
  2500.                    re-pri-mir
  2501.                   \co-pla
  2502.                    co-pla
  2503.                   \te-cla
  2504.                    te-cla
  2505.                   \res-pi-ro
  2506.                    res-pi-ro
  2507.                   \obs-t'a-cu-lo
  2508.                    obs-t'a-cu-lo
  2509.  
  2510.           6.5.3 Some change table techniques
  2511.  
  2512.                One can use the fact that the hyphenation rules  are  ordered
  2513.           to  one's  advantage.  Consider an example from Ticuna, a Peruvian
  2514.           jungle language.  The sequence arj needs to be hyphenated as  -arj
  2515.           word  finally  and  a-rj  elsewhere  (j  is a vowel).  The segment
  2516.           defintion file includes the following classes:
  2517.  
  2518.                   TIPHYP.SEG Character classes for Ticuna (Peru) hyphenation
  2519.           
  2520.                   CLASS V
  2521.                     e i o u
  2522.                   CLASS C
  2523.                     b c ch d f g l m n ~n ng p q s t w y
  2524.                   CLASS A
  2525.                     a
  2526.                   CLASS J
  2527.                     j
  2528.                   CLASS R
  2529.  
  2530.  
  2531.  
  2532.           DOCUMENT PREPARATION AIDS                                       42
  2533.  
  2534.                     r
  2535.           
  2536.           Notice that a, r, and j are in  separate  classes  by  themselves.
  2537.           The hyphenation rules include the following changes:
  2538.  
  2539.                   TIPHYP.CHG  changes for hyphenation of Ticuna (Peru)
  2540.           
  2541.                   "ARJ#"  > "-arj#"
  2542.                   "A"     > "V"
  2543.                   "J"     > "V"
  2544.                   "R"     > "C"
  2545.                   "VCV"   > "V-CV"
  2546.           
  2547.           Note  here that the word final exception is treated first.  If the
  2548.           sequence arj is not word final, then  the  second  through  fourth
  2549.           changes  will  convert the "ARJ" class sequence into a "VCV" class
  2550.           sequence.  This allows  the  final  change  to  make  the  correct
  2551.           hyphenation.
  2552.  
  2553.  
  2554.  
  2555.                    7. DELIMITER CHECKING AND NESTING CHECK (DELIM)
  2556.  
  2557.           7.1 Introduction
  2558.  
  2559.                Delimiters  are  symbols  used  in  pairs to enclose specific
  2560.           information.  The  most  common  delimiter  pair  is  parentheses.
  2561.           others  are  square brackets or curly braces.  DELIM tests whether
  2562.           delimiters are paired and properly nested.  The user  may  specify
  2563.           the  delimiters  to  be checked; for example, he may wish to check
  2564.           the following:
  2565.  
  2566.                   ( ) { } " " ` ' [ ] < >
  2567.  
  2568.           DELIM reports the errors in such a way that they are easy to find.
  2569.           Multiple  files may be checked.  DELIM never changes the file that
  2570.           is being checked.
  2571.  
  2572.                DELIM is useful for the preparation of any text  which  makes
  2573.           use  of  delimiters.   For  example,  many  linguistic papers have
  2574.           frequent parentheses, phonetic and  phonemic  bracketing  ([]  and
  2575.           //),  and  glosses (`') all of which must be balanced and properly
  2576.           nested, for example, [atox] /atuq/  `fox'.   Sometimes  formatting
  2577.           programs  (e.g.,  SCRIBE)  and  often programming languages (e.g.,
  2578.           PTP, C) require heavy use of delimiters.  (While errors  in  these
  2579.           can  sometimes  be  discovered  by  running  the  program, it will
  2580.           generally be much quicker to discover the errors  with  DELIM  and
  2581.           correct them before running the program.)
  2582.  
  2583.           7.2 Running the program
  2584.  
  2585.                DELIM begins to run with the following message:
  2586.  
  2587.                DELIMITER PAIRING AND NESTING CHECK Version 2.1 (12-Dec-86)
  2588.           
  2589.                 Press <RETURN> to use these delimiters:
  2590.                 ({["
  2591.                 )}]"
  2592.  
  2593.  
  2594.  
  2595.           Delimiter Checking and Nesting Check                            43
  2596.  
  2597.                 Otherwise type delimiter file name:
  2598.  
  2599.           If you are satisfied with this list of delimiters, simply  type  a
  2600.           carriage return.  Otherwise specify the name of the delimiter file
  2601.           that includes the delimiters you want to check.  The form of  such
  2602.           a file is discussed in section 7.4.  Next you will be asked for an
  2603.           output file:
  2604.  
  2605.                   Output file: [con]
  2606.  
  2607.           If you simply type a carriage return, the output will  be  put  to
  2608.           the  terminal.   If  you  wish to have the output printed directly
  2609.           (i.e., without first creating a file on some device), respond with
  2610.           prn  (or  however  you refer to your printer).  If you type a file
  2611.           name, the result will be written to that file.  Next, by means  of
  2612.           the prompt
  2613.  
  2614.                   Input file:
  2615.  
  2616.           you  are  asked  for  the  file  to  be checked.  Respond with the
  2617.           appropriate file name.  When DELIM  finishes  checking  the  first
  2618.           file,  it asks for another file to be checked:
  2619.  
  2620.                   Next input file: (<RETURN> if no more)
  2621.  
  2622.           When there are no more files to be checked, simply type a carriage
  2623.           return to return to the monitor.
  2624.  
  2625.  
  2626.           7.3 The form of the output
  2627.  
  2628.                The output file will contain, for each  file  being  checked,
  2629.           its  name, the potential errors found in that file, and the number
  2630.           of potential errors found in that file.
  2631.  
  2632.                There are two sorts of errors.  First, there might be a right
  2633.           delimiter  for  which  there  was  no  previous corresponding left
  2634.           delimiter.  For example, if a file started with the line
  2635.  
  2636.                   This is a file ] which has an error.
  2637.  
  2638.           the error would be reported as follows:
  2639.  
  2640.                   unmatched right ] on line 1
  2641.                   This is a file ] which has an error.
  2642.                                  ^
  2643.  
  2644.           If a 15 line file ended with
  2645.  
  2646.                   This is a file { which has an error.
  2647.  
  2648.           the error would be reported as follows:
  2649.  
  2650.                   unmatched left { on line 15
  2651.                   This is a file {
  2652.                                  ^
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.           DOCUMENT PREPARATION AIDS                                       44
  2659.  
  2660.           7.4 How to write a delimiter file
  2661.  
  2662.                To  specify  delimiters  other  than  the  defaults,  it   is
  2663.           necessary  to  create a delimiter file.  This file contains two or
  2664.           three lines.  The optional first line  is  reserved  for  comments
  2665.           such  as  "Delim  file  for  XYZ."   The  second  line should list
  2666.           (without  intervening  spaces,  commas,   etc.)   all   the   left
  2667.           delimiters.   The  third  line should list the corresponding right
  2668.           delimiters,  with  each  right  delimiter   directly   below   the
  2669.           corresponding  left  delimiter.   For example, The following is an
  2670.           acceptable delimiter file (where there is nothing on lines two and
  2671.           three other than the delimiters, and all lines end with a carriage
  2672.           return):
  2673.  
  2674.                   This is a DELIM file for XYZ
  2675.                   [{(
  2676.                   ]})
  2677.  
  2678.                Any character can be  given  as  a  delimiter,  but  note,  a
  2679.           delimiter can only be a single character.
  2680.  
  2681.                If  the last two lines of the delimiter file are not the same
  2682.           length, you will be informed with the  message  when  the  program
  2683.           runs:
  2684.  
  2685.                   Delimiter lists are not the same length.
  2686.  
  2687.                It   is  possible  (and  sometimes  desirable)  to  give  the
  2688.           delimiters to be checked directly from the terminal.  This can  be
  2689.           done  by giving the terminal device name in response to the prompt
  2690.           (tt: for RT-11, con for MS/DOS) for a delimiter file name,  typing
  2691.           the  two  lines of left and right delimiters, and then closing the
  2692.           file with a ^Z (control Z).  For example, if one wished  to  check
  2693.           only  the  delimiter  pairs  ( )  and [ ], he could respond to the
  2694.           prompt for a delimiter file with tt: (on RT-11 systems), then type
  2695.           the sequence:
  2696.  
  2697.                   ( [ <RETURN> ) ] <RETURN> ^Z
  2698.  
  2699.  
  2700.           7.5 Program limitations
  2701.  
  2702.                One actual error sometimes causes DELIM to report many errors
  2703.           (i.e., errors are  said  to  "cascade").   Thus,  sometimes  error
  2704.           messages  subsequent to a real error should simply be disregarded.
  2705.           If the real error  is  fixed,  the  subsequent  (erroneous)  error
  2706.           messages go away.
  2707.  
  2708.                Too  many  unmatched left delimiters (more than approximately
  2709.           15) will cause DELIM to terminate with a message beginning  "Stack
  2710.           overflow..."  If this happens, control is returned to the monitor.
  2711.           Try checking the file with fewer delimiter pairs or  correct  what
  2712.           errors you can and rerun the program.
  2713.  
  2714.                Delimiters   cannot   span   files,  that  is,  corresponding
  2715.           delimiters must be in  the  same  file.   DELIM  does  not  ignore
  2716.           delimiters in comments or in quoted strings.  DELIM can check only
  2717.           99 pairs of delimiters.
  2718.  
  2719.